mcfearsome (owner)

Revisions

gist: 109467 Download_button fork
public
Public Clone URL: git://gist.github.com/109467.git
Embed All Files: show embed
git-how_to_diff_files_in_different_commits.sh #
1
2
git diff <$commit1>:path/file <$commit2>:otherpath/otherfile
 
git-manual_merging.example #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ git ls-files --unmerged --abbrev
...
100755 33cd1f76... 1 util/endian.h
100755 7f531bb7... 3 util/endian.h
 
Then to do merge between the versions for the "undetected rename" file, extract two blobs (whose sha1 you have from git-ls-files(1) or git-status(1) output) to temporary files, and run "merge" command by hand, e.g.
 
$ git cat-file blob 33cd1f76 >endian.h-1
$ git cat-file blob 7f531bb7 >endian.h-3
$ merge src/util/endian.h endian.h-1 endian.h-3
(* A third file is being pulled in and merged *)
 
** The case of a file move/rename not being detected **
Once you come up with the desired state in your file (src/util/endian.h in our example), then you have to inform Git that file was renamed, i.e. say "git update-index --remove util/endian.h" in our example (removing the file from working directory as well, if it exist there) and then "git update-index src/util/endian.h" (you should have it already in the index, so you do not have to say --add).