Git 使用方法

  因为公司采用Gitlab作为代码的版本管理系统,所以git是一边学一边用。记录下来使用方法。

  git 初始化

1 git config --global user.name "Su Moning"
2 git config --global user.email "[email protected]"
3 git config --global core.editor vim
4 git config --global core.autocrlf input
5 git config --global color.status auto            ---颜色的一些设定
6 git config --global color.diff auto
7 git config --global color.branch auto
8 git config --global color.interactive auto
9 git config --global core.quotepath false

  git 克隆远程仓库

1 git clone [email protected]:sumoning/sumoning.git

   git 添加远程仓库

1 git remote add [email protected]:sumoning/sumoning.git

   git 显示远程仓库

1 git remote -v

   git tag管理

git tag                                        --显示所有的tag
git checkout -b branch  0.1.0               --将tag 0.1.0检出并作为新的branch
git tag 0.1.1                                  --添加新的tag 

   git 添加文件

1 git add .                                    --添加所有
2 git add a.txt                                --添加指定文件

        git 提交文件

1 git commit -m "添加了新文件"                   --'-m'为备注

   git 查看当前状态

1 git status

  git 比较差别

1 git diff                   ----所有
2 git diff file              ----指定看某个文件

     git 删除文件,用法和linux上的rm相似

1 git rm

猜你喜欢

转载自www.cnblogs.com/sumoning/p/6688591.html