Skip to content

Instantly share code, notes, and snippets.

@yang-chao
Last active April 15, 2016 03:08
Show Gist options
  • Save yang-chao/f557f43f0af1650c1880 to your computer and use it in GitHub Desktop.
Save yang-chao/f557f43f0af1650c1880 to your computer and use it in GitHub Desktop.
1.合并分支中的指定文件
There have two branches A and B with the same files but a different programming interface in some files.
Now the methods of file f, which is independent of the interface differences in the two branches, were changed in branch B,
but the change is important for both branches. Thus, I need to merge just file f of branch B into file f of branch A.
git checkout <branch_A>
git checkout --patch <branch_B> <file_name>
2.合并其它分支中的文件
git checkout <branch_name> -- <paths>
3.将当前分支rebase到master顶端
git pull --rebase origin master
4.把本地tag推送到远程
git push --tags
5.删除远程tag
git push origin --delete tag <tagname>
或者
git tag -d <tagname>
git push origin :refs/tags/<tagname>
6.删除远程分支
git push origin --delete <branchName>
7.检出tag
git checkout -b <branch_name> <tag_name>
8.切换到标签
git checkout <tagname>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment