1

I'm using Git with many feature branches.

When I want to update master and featureX

# Update master
git checkout master
git pull

# Update featureX
git checkout featureX
git pull

It works and simply. But it takes a while because I run git pull including fetch twice.

In another way...

# Update featureX
git checkout featureX
git merge origin/featureX

OK, I fetched only once. But I have to specify origin/featureX even the branch is upstream.

Is there an alias for upstream, or easy way to update branch without fetching?

unarist
  • 616
  • 8
  • 26

1 Answers1

2

From this answer, an alias for upstream is

git rev-parse --symbolic-full-name --abbrev-ref @{u}
Community
  • 1
  • 1
Vaibhav Sagar
  • 2,208
  • 15
  • 21
  • 1
    In this case, I don't need `rev-parse` because `@{u}` is also valid. So `git merge @{u}` works fine! Thanks! – unarist Apr 13 '15 at 06:23