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,553,378
Community Members
 
Community Events
184
Community Groups

How to apply files from stash selectively?

How can I apply files inside a stash selectively? Rather than right-clicking on the stash and applying it in its entirety?

7 answers

1 accepted

3 votes
Answer accepted
stevestreeting
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 26, 2012

Unfortunately git stash doesn't support doing this. You basically have to apply the stash, then only stage the parts that you want to commit. You can then re-stash the remainder (or discard it).

ok so the following commandline feature isn't in the SourceTree roadmap yet?

$ git checkout stash@{0} -- <filename>

Git itself does support this.

Like a_sobolev likes this

As stated above, git naturally supports this via

$ git checkout stash@{0} -- <filename>

You can even show the stashed version and save it under a different name:

$ git show stash@{0}:<full/filename>  >  <newfile>

Git is just powerfil like that. :-)

I would love to see the stash feature extended to include these usages in SourceTree.

any updates on this? Cannot find how to apply only certain files/chunks from git stash. I used that on other project with TortoiseHg and like it. Can't find how to do same with sourcetree.

+1 for the feature. It's really annoying that at the end of 2019 we still don't have it. Please, add it.

1 vote
Wim Deblauwe
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.
Apr 12, 2016

Is there a JIRA issue we can vote on for this?

BTW: You can see here (http://stackoverflow.com/a/22555169/40064) how to do it manually.

Recently I looked up `custom actions` but they aren't an option that is available when right-clicking on anything related to a stash.

FYI I tried the "Keep staged changes" check box when making the stash, but unfortunately this still stashes the staged changes along with the unstaged ones.

Perhaps no way to do it while applying the stash (that would be nice).
But you can achieve the affect by applying the stash, and then stashing just the hunks that you don't want (leaving the bits/files you do).

 

Command line equivalent is:

git stash pop stash@{x}
git stash -p

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events