top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

Is there a way to achieve something like 'git stash apply --patch'

0 votes
27 views

After switching from svn/hg to git and getting some experience, I feel I'm ready to figure out which questions aren't too obvious. My feeling is the current question isn't.

Today I was hacking away, only to discover that I was really working on too much stuff at once. I wanted to stash away a sub-set of my changes, and leave the rest to focus on first. So I did a 'git stash --patch', selected the patches I wanted to move away for now. Only to discover that I stashed away 2 patches too many .... Bummer.

Alas: I kind of hoped I could do something like 'git stash apply --patch stash@{1}'...... but that didn't quite work: I just got the full stash applied on top of the working directory (to be verbose: this was done after stashing the remaining patches).
I hope my situation was explained clearly enough. My question is not about how to recover. That's easy by redoing the original stash command, but properly this time. My question is more about learning something more about git, in case I end up in the same, or a similar situation in the future:
* is there a way to force 'git stash --patch' to create a separate stash for each patch that I select? This would make it possible to apply each patch again afterwards, and would have been a perfect solution in my case as well
* otherwise, is there a way to achieve the result I had hoped for when running 'git stash apply --patch', namely to selectively apply hunks

In case the answer to both of these is 'No', what would be the proper way and/or place to suggest such a feature?

posted May 15, 2013 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

Similar Questions
+3 votes

When we clone a remote GIT repository, all folders/files will be cloned. This will consume lot of disk space in our local machine.
Is there a way to clone only few folders & exclude others?

This is possible in clearcase snapshot view by changing load rules.

+1 vote

I have a large Git project which I would like to dissect into subprojects with their own repositories. Git subtrees are ideal for this task: I first

  • create a branch with the contents of only one subfoldergit subtree split -P -b

and then

  • pull this branch into another repository.

For a transitional phase, I would like to have the subprojects read-only and sync them from master. The question is how to organize this. For every commit to master, I could of course perform the above procedure repeatedly for all subprojects, but this seems less then ideal since it does all the work all over again.

Is there a way to merge master into the subtree branches?

+5 votes

I know form the "git log" we can now the commit time, but how to know when it is in the remote git server.

+1 vote

The use case:
"git submodule update" seems to be inefficient when running sequentially on a large .gitmodules file. Assuming a git forest with over 7K gits it takes hours to complete the update (running on Windows+Cygwin)

If not supported, this feature could be a good candidate for "git submodule" enhancement.
What is your opinion or advice?


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...