Created
September 12, 2013 02:56
-
-
Save cizixs/6532608 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| First, clone a remote Git repository and cd into it: | |
| $ git clone git://example.com/myproject | |
| $ cd myproject | |
| Next, look at the local branches in your repository: | |
| $ git branch | |
| * master | |
| But there are other branches hiding in your repository! You can see these using the -a flag: | |
| $ git branch -a | |
| * master | |
| remotes/origin/HEAD | |
| remotes/origin/master | |
| remotes/origin/v1.0-stable | |
| remotes/origin/experimental | |
| If you just want to take a quick peek at an upstream branch, you can check it out directly: | |
| $ git checkout origin/experimental | |
| But if you want to work on that branch, you'll need to create a local tracking branch: | |
| $ git checkout -b experimental origin/experimental | |
| Now, if you look at your local branches, this is what you'll see: | |
| $ git branch | |
| * experimental | |
| master | |
| You can actually track more than one remote repository using git remote. | |
| $ git remote add win32 git://example.com/users/joe/myproject-win32-port | |
| $ git branch -a | |
| * master | |
| remotes/origin/HEAD | |
| remotes/origin/master | |
| remotes/origin/v1.0-stable | |
| remotes/origin/experimental | |
| remotes/win32/master | |
| remotes/win32/new-widgets | |
| At this point, things are getting pretty crazy, so run gitk to see what's going on: | |
| $ gitk --all & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment