Skip to content

Instantly share code, notes, and snippets.

@canton7
Created May 20, 2011 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save canton7/983719 to your computer and use it in GitHub Desktop.
Save canton7/983719 to your computer and use it in GitHub Desktop.
Tracking in Git
Scenario | Tracking set up
----------------------------------------------------------------------------------|-----------------
Clone a (non-emtpy) repo, use the branch which is checked out automatically | Y
Push a branch to a remote, that doesn't exist on the remote | N
Push a branch to a remote, that doesn't exist on the remote, with push -u | Y
Checkout a branch from a remote, without -t (specified or implied) | N
Checkout a branch from a remote, with -t (specified or implied) | Y
1. Clone an empty repo.
'git fetch' fetches objects: Y
'git pull' works: Y
'git push' works: N
2. git push origin master
'git fetch' fetches objects: Y
'git pull' works: Y
'git push' works: Y
3. git checkout -b new_branch
'git fetch' fetches objects: Y
'git pull' works: N
'git push' works: Y
4. git push origin new_branch
'git fetch' fetches objects: Y
'git pull' works: N
'git push' works: N
5. git push -u origin new_branch
'git fetch' fetches objects: Y
'git pull' works: Y
'git push' works: Y
6. git checkout -b another_branch
'git fetch' fetches objects: Y
'git pull' works: N
'git push' works: N
7. git push origin another_branch
'git fetch' fetches objects: Y
'git pull' works: N
'git push' works: Y
8. git branch --set-upstream another_branch origin/another_branch
'git fetch' fetches objects: Y
'git pull' works: Y
'git push' works: Y
9. git checkout master &&
git branch -d new_branch &&
git checkout -t origin/new_branch OR git checkout -b new_branch origin/new_branch
'git fetch' fetches objects: Y
'git pull' works: Y
'git push' works: Y
10. git checkout master &&
git branch -d new_branch &&
git checkout --no-track -b new_branch origin/new_branch
'git fetch' fetches objects: Y
'git pull' works: N
'git push' works: N
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment