LMLPHP后院

关于 GIT 使用的几个常用命令技术

maybe yes 发表于 2017-09-18 21:20

介绍几个 GIT 很实用的命令,一般人不容易掌握哦。

如何检出一个远程分支,并且要求检出的分支名称和它不同,怎么做?

git checkout -b <branch> --track <remote>/<branch>
// 
$ git checkout -b tmp --track origin/feature-20170918

如何删除一个本地的远程分支?

git branch -d -r <remote>/<branch>
//
$ git branch -d -r origin/dev

如何推送一个分支到远程分支,分支的名称不相同,怎么做?

git push <remote> <branch local>:<branch remote>
//
$ git push origin tmp:feature-20170918

如何使用分支,备份代码

$ git remote add origin_bak
$ git push origin_bak tmp:code_bak_20170918
相关文章
2024-04-27 07:59:11 1714175951 0.006807