Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,575
Community Members
 
Community Events
184
Community Groups

Pulling non-active branch in Sourcetree (or GIT)

We are quite new to GIT and Sourcetree, and things are going pretty well.  Unfortunately for me, I have become one of the go-to guys for when new team members come onboard.

We have a process workflow that works well, but I keep thinking there may be a better (quicker/simpler) way to update feature branches.


Specifically:    We never work on develop itself, every bit of work however small is done on it's own branch, and a pull request enforced for merging back to develop (all good so far).


The problem arises when other developers have updated our develop branch, we encourage everyone to update their own feature branches often, and the sequence we show them is:

 

  • Switch to Develop
  • Pull Changes
  • Switch back to their branch
  • Merge develop into their branch to update it.

 

Is there a way to achieve this in Sourcetree without having to switch branches?


Many thanks.

5 answers

1 accepted

2 votes
Answer accepted
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 30, 2015

If you want to stay in SourceTree, you can do a fetch (doesn't matter what branch is checked out), then merge directly from the remote develop branch by expanding the >Remotes branch list, and right clicking on that develop (probably origin/develop).

The Pull operation currently performs a Fetch for you, so you'll want to make sure you do this manually since you're using Merge instead of Pull.

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 01, 2015

+1 for this, I teach our developers to stay in the feature branch, pull/fetch, merge origin/develop into the feature branch and push the merge. Also, most of the time it makes no difference whether they merge often, unless you have a small codebase with many developers. So I would not tell them to merge often.

Many thanks. Just tried this and it does what I expect. Will talk with our new to GIT developers and show the m this method.

4 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 29, 2015

I'm a CLI guy too, and I'd recommend your guys become so too if possible...

As well as what Chris says, we all use "git up", or for windows, which will update all your branches, including stashing changes if necessary, and rebasing your feature branch if you are sharing it.

Then generally we rebase our feature branch ("git rebase develop") on top of develop/master, which keeps things nice and clear.

Shameless plug: I wrote a few notes about how we improved our PR process here: http://www.adaptavist.com/w/inside-adaptavists-stash-pull-request-workflow/. What's not in that, I don't think, is we use an event handler to stop people create PRs until they have merged/rebased. This gives us the best likelihood that when people come to review it won't already be conflicted, and that the build will be the same as the one done when merged.

 

This is possible in Windows version of Sourcetree, but not on mac. I have no idea why. It is very simple - you just right click a branch and choose "fetch branch". It makes `git fetch origin branch-name:branch-name`. If branch can be fetched with ffd, it will succeed.

I really hope this will be implemented also in Sourcetree for mac.

I cannot overstate how much I would appreciate this feature.

Like # people like this

Why is this not possible in mac :(

Like JanTuts likes this
1 vote
crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jun 29, 2015

I'm a command line guy, so I can't really help you with source tree, but...

git fetch origin develop:develop

is how I would normally do this.

Hmm, not sure either CLI or installing a different GIT are going to cut it with other developers in our company....

 

Many are CLI-phobics smile

 

0 votes
sreekumar_menon
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 30, 2015

I personally prefer to do this in command line too.

There are couple more options in merge within sourcetree -

  1. In "merge from log" tab, select jumpto and select your remote branch and merge it to your current branch.
  2. if you have already fetched the remote branch, mac version has "Merge fetched" tab, that allows you to merge the fetched branch without switching to the branch. I don't thinkj this is available in windows version.  

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events