Suppose I have altered a file which was versioned and renamed it using something other then GIT, but I only want to include some diffs from that file? How would I do that?
The problem is that GIT can only add complete new files.
The scenario is probably better understood by example:
$ mkdir temp
$ cd temp
$ git init
$ nano 1.txt
$ cat 1.txt
I am file 1.txt
2
3
4
5
$ git add 1.txt
$ git commit -m "1st commit"
$ #edit some stuff and rename using something else than git
$ cat 2.txt #note, 1.txt is renamed to 2.txt
1 I am file 1.txt
2 I am now file 2.txt
3
4
5
6
$ #note the line with '6 'is added
What are my options now, to commit only the rename and the line change of "2" to "2 I am now file 2.txt" but not the addition of the line with '6'.
Externally renaming back and using git mv
is not really a solution in my case, because of the many renames possible by the refactoring in an IDE.
basically, I want to get in the situation you'd normally get by having done git mv 1.txt 2.txt
, in that case you could interactively select which lines in 2.txt you'd want to stage.