git 基本用法

返回上一个文件

git reset --hard HEAD~1

创建文件

mkdir 文件名

调用文件

cd 文件名

文件夹里添加文本

touch index.html

 

文本添加内容

vim 文本名 退出时 按Esc键 输入:wq 回

上传文件

初始化

git init

添加工作区间

git add

添加全部文件工作区间

git add .

查看当前文件状态

git status

克隆

git clone (git 文件链接)


文件所在地

pwd

提交备注

git commit -am "项目名"

链接到git

git remote add origin 链接(git创建的文件链接)

更新后上传时如果上传失败

git remote rm origin

上传git

git push -u origin master(分支名; 默认master)
git push -f origin master (强制上传)

长期存储密码

git config --global credential.helper store

 创建分支

 git branch masters

  切换到分支

git checkout mastars

修改本地文件在pull的时候pul不下来的时候

 git stash    备份本地文件

创建分支到切换分支

git checkout -b masters(分支名masters)

报错解决

在执行 git status || git add .时  

Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'.

解决方法

  移除 .git/index.lock
  $ rm -f ./.git/index.lock  
posted @ 2017-07-13 11:48  朋友你好我是小院  阅读(138)  评论(0)    收藏  举报