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

Stash pull issue

pravihs February 9, 2016

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

1 vote
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.
February 10, 2016

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.

Tim Crall
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.
February 10, 2016

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!)

pravihs February 10, 2016

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

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.
February 11, 2016

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

pravihs February 18, 2016

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
TAGS
AUG Leaders

Atlassian Community Events