From f69b0ce35e78f4336dc9e721e859690f8bf9613c Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Thu, 17 Jan 2013 14:02:13 -0500 Subject: A caveat about using git-checkout to rebuild commits. --- wiki/git/survival.md | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'wiki') diff --git a/wiki/git/survival.md b/wiki/git/survival.md index 35ca572..d7a79c1 100644 --- a/wiki/git/survival.md +++ b/wiki/git/survival.md @@ -64,6 +64,11 @@ will screw you. Here are a few things I've picked up that have saved my bacon. * Gotcha: `git checkout -p` will do nothing for files that are being created. Use `git checkout`, instead, and edit the file if necessary. Thanks, Git. + * Gotcha: The new, clean branch must diverge from its upstream branch + (`origin/master`, in the example above) at exactly the same point, or + the diffs presented by `git checkout -p foo` will include chunks that + revert changes on the upstream branch since the "dirty" branch was + created. The easiest way to find this point is with `git merge-base`. ## Useful Resources -- cgit v1.2.3