命令的最终修改都是针对.git/config文件
1 @ 使用--set-upstream去跟踪远程分支
git branch --set-upstream my_branch origin/my_branch
origin is your remote repo , you can add a remote repo :
git remote add [ options] <name> <url>
[ options ] -f, --fetch fetch the remote branches
-t, --track <branch> branch(es) to track
-m, --master <branch>
master branch
--mirror[=<push|fetch>]
set up remote as a mirror to push to or fetch from
2 @ 替代
该语法等价于第一次提交分支时,使用git push -u origin my_branch
在第一次提交你的分支的时候使用。它会像git branch --set-upstream一样在本地分支与远程分去建立联系。
通常我们在新建分支的时候,一定要显式建立这种联系。
3 @ 替代
- # git remote add <name> <url>
- # git config branch.master.remote <name>
- # git config branch.master.merge refs/heads/master