git常用命令

git branch #查看当前分支

git checkout branch_name

git checkout -b branch_name 1a222c3

git stash #暂存

git stash pop #弹出

git status

git log --pretty=oneline

git cherry-pick a46ec44 1a222c3 #复制a46ec44 1a222c3两个修改点到分支上

git commit -m "我的第一次提交" // 提交当前变更, -m 参数表示提交注释信息

git commit -a // 提交所有变更

在branch1上
git merge branch2
test.txt冲突,解决冲突后
git add test.txt
git commit

一般我们把别的分支合并到master时用merge,而把master合并到别的分支时会用到rebase(rebase不会产生多余的commit,并且保持直线

git checkout -- hello.rb #这条命令把hello.rb从HEAD中签出并且把它恢复成未修改时的样子.

git rebase,解决冲突后 git rebase --continue

 

git tag {tagName}
git push origin {tagName}:refs/tags/{tagName}

posted @ 2017-03-13 15:56  感遇  阅读(109)  评论(0)    收藏  举报