rogerxu / git-tips

Tips for Git
Apache License 2.0
2 stars 3 forks source link

Remote #22

Open rogerxu opened 7 years ago

rogerxu commented 7 years ago

Make an existing Git branch track a remote branch? - Stack Overflow

rogerxu commented 7 years ago

Track current branch to an upstream branch

git branch -u origin/master
git branch --set-upstream-to=origin/master
git push -u origin master
rogerxu commented 6 years ago

Tracking remote branch and creating a local branch with the same name.

git checkout -t origin/{{branch_name}}
rogerxu commented 6 years ago

Add a branch in remote fetch list.

git remote set-branches --add origin master
[remote "origin"]
    fetch = +refs/heads/master:refs/remotes/origin/master
rogerxu commented 4 years ago
$ git remote set-url origin <url>