![]() ![]() Git difftool - path/to/file to compare a single file Git difftool -d to compare a whole stash and all its files If you have a graphical diff tool supported by git (like meld), you can use git difftool and "apply left" only the changes you're interested in:.But if you wanted to do a partial apply of your stash to avoid conflicts, this won't really help. Be really careful with the patches you accept when you do git checkout -p Do a git stash pop, then git stash again before doing git checkout -p.There are a few workarounds, none of them are perfect for every situation: (In case you're wondering, git checkout -p a stash from a parallel branch will try to revert all changes between the current commit and the original branching point and also apply all changes between the branching point and the other branch, besides the change in the stash). into a branch that is a number of commits from before the commit on which the stash is based, then git checkout -p will try to also apply all the other changes that happened between the current commit and the commit from the future, besides the changes from the stash itself. In the case of a git stash, if the stash you're trying to apply was done against a different commit, then git checkout -p will try to apply interactively all the differences between the commit and the commit of the current workspace, including all their parent commits that are different.įor example, if you're trying to apply a stash that was saved "many commits ago" into the current workspace, git checkout -p will try to apply not only the changes in the stash proper, but will also try to revert all changes that happened between the commit on which the stash is based and the current commit.Ĭonversely, if you're trying to apply a stash "from the future", i.e. CaveatsĪs mentioned in the comments below, git checkout -p tries to apply the whole difference between a commit and the current workspace. The key is to realize that stashes are, in essence, references to commits just like tags and branches. Use git stash list and git show -p if unsure which n is the stash you want to apply.ĭon't forget to git stash drop when you know you won't need that stash anymore, since git checkout obviously will not drop the stash for you. This is a public inbox, see mirroring instructionsįor how to clone and mirror all data and code used for this inbox Īs well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).Is it possible? Yes it is! git checkout -p you can replace the 0 in with the index of the stash you want to apply. ![]() * If your mail client supports setting the In-Reply-To headerīe sure your reply has a Subject: header at the top and a blank lineĬode repositories for project(s) associated with this public inbox * Reply using the -to, -cc, and -in-reply-to * Save the following mbox file, import it into your mail client,Īvoid top-posting and favor interleaved quoting: You may reply publicly to this message via plain-text email 22:58 Stash pop/apply conflict and -theirs and -ours Sven Strickroth ![]() Thread overview: 2+ messages / expand mbox.gz Atom feed top I'm still not convinced it's a good idea, though. "2" bits in the index after the conflicted merge completes. Side represents the current working tree, so we might do things likeĬheck whether the index is fresh). The unpack-trees codeĭoes not treat "ours" and "theirs" entirely symmetrically (the "ours" Suspect it may be hard to implement in practice. Some kind of option (and things like pull autostash could use it), but I Would be the right thing to do in all cases. So I sympathize, but I don't think that having "stash" flip the order Then conceptually the stash is "ours" and HEAD is "theirs". I guess if you are stashing in order to pull somebody else's work, like: If we merge, then -theirs is the branch we are merging: Is true of "stash", too (I basically think of "stash apply" as a That is true of "merge" and "cherry-pick". Operation started, and "theirs" is what the operation is bringing into The "ours" content is generally what was in the HEAD before the I don't think anybody has ever mentioned it for stash. I know that people have complained about "rebase" swapping the two, but > From the HCI perspective this is really counter intuitive. > -ours and -theirs are swapped when a conflict occurrs on git stash > I regularly experience that beginners have problems unterstanding that On Sun, at 12:58:12AM +0200, Sven Strickroth wrote: Subject: Re: Stash pop/apply conflict and -theirs and -oursĭate: Sun, 05:30:32 -0400 Re: Stash pop/apply conflict and -theirs and -ours - Jeff King mailing list mirror (one of many) help / color / mirror / code / Atom feed From: Jeff King ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |