Stash pull issue

We are using Stash as our SCM. Currently we are a team of three (developer1,developer2,developer3). Developer1 is working on branch1 of a stash repository. He has pushed some changes on branch1 which I am also working.I want to pull the branch1 data from remote server to my working copy.

But pull got aborted because I have my local changes via 'source tree tool'. How can I keep my local changes and pull the data from remote server without overwriting it? I want to push the local changes to remote afterwards as latest commit.

I was using SVN before. In SVN If my working copy have the old commit, svn client will prompt me to update my working copy and subsequently ask me to merge my changes if there is need. I need similar feature now. 

Please help.

1 answer

With Git you have two options.

Most common: commit your local changes, then Pull. This will automatically merge the remote branch with your local branch, then you can push.

A different option would be to Stash your uncommitted changes ("stash" is also a git feature, not just an SCM), pull the remote branch, then apply the stash, commit, and push. Stashing basically packages up uncommitted changes and restores your working copy to a clean state.

Agreed; I think git (SourceTree) will behave just as you want it to if you just commit your changes before pulling.  Although I'd also recommend that you consider working on separate feature branches and merging only as a specific conscious step (but regularly!)

Thanks Foss. How can I 'git stash' using stash tree? I dont find any options as such in source tree tool. 

If you're using Git, you should have a "Stash" button at the top of your SourceTree UI. It might be called something different if you're using Mercurial.

image2016-2-11 8:35:51.png

Thanks. Found it. It was hidden since there was no change in the working copy earlier.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,227 views 4 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you