Tugqi Biz
  • Home
  • Categories
  • Tags
  • Archives

git 复习巩固(4)

分支¶

# 新建分支¶

git branch branch-name

新建并切到该分支¶

git checkout -b branch-name

删除分支¶

$ git branch -d experimental

-d只能删除那些已经被当前分支的合并的分支.¶
强制删除某个分支的话就用 –D¶

$ git branch -D crazy-idea

合并冲突¶

git merge branch-name
 100% (4/4) done
Auto-merged file.txt
CONFLICT (content): Merge conflict in file.txt
Automatic merge failed; fix conflicts and then commit the result.
解决合并中的冲突¶

有冲突(conflicts)的文件会保存在索引中,除非你解决了问题了并且更新了索引,否则执行 git commit都会失败:

git commit
file.txt: needs merge

撒销一个合并¶

放弃修改撤回到本分支头部 git reset --hard HEAD
或 git checkout -f
撤回到之前的commit git reset 4ba467213eb73480431b95c7dba03aac1c7a2c26


  • « git 复习巩固(5)
  • git 复习巩固(3) »

Published

Mar 29, 2015

Category

It

Tags

  • git 8
  • Powered by Pelican. Theme: Elegant by Talha Mansoor