Git Tip of the Day – track remote branches easily

Because I always forget it and then can’t remember, I have to write this down.

I have some local and remote branches in my project:

$ git branch -avv
* master                         74b7a34 [origin/master] Release 0.6.0
  release-0.6                    69adc4e [origin/release-0.6] Release 0.6.0
  remotes/origin/HEAD            -> origin/master
  remotes/origin/aqc             b4ff4ba update to Fedora 14, remove crontab handling
  remotes/origin/clumens         ce5b3f1 Rollback previous README change.  The --url hook argument still exists.
  remotes/origin/copylib         1888da9 copy config files and autoqa library to the client
  remotes/origin/hongqing        8fc7a53 run analog in install.py

Now if I want to check out a remote branch called aqc, have it available in a local branch and set it as tracking, there is a neat short command to do all of this at once (instead of combining different options and whatnot):

$ git checkout aqc
Branch aqc set up to track remote branch aqc from origin.
Switched to a new branch 'aqc'
$ git branch -vv
* aqc         b4ff4ba [origin/aqc] update to Fedora 14, remove crontab handling
  master      74b7a34 [origin/master] Release 0.6.0
  release-0.6 69adc4e [origin/release-0.6] Release 0.6.0

Oh yes.

Flattr this

Advertisements
Git Tip of the Day – track remote branches easily

Leave a Reply (Markdown syntax supported)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s