To: boost@lists.boost.org From: eldiener@tropicsoft.com Date: Tue, 10 Dec 2013 22:19:30 -0500 Subject: Re: [boost] [git] The any library does not pull cleanly because of a forced update on develop and master.
It sounded like in git one must continuously specify --follow after the move with each commit in order to preserve history, or was the person who said that mistaken ?
Intuitively to me once one uses a command to tell git that a file in a repository is being moved/renamed to something else in the repository and that the previous history should follow that file, then one should always be able to see the full history of that file both before ane after the move/rename.
It's just as painful in SVN to view the contents of a past file through a copy/move/delete, until you get experienced with peg revisions or you use an interactive repository browser to view the whole tree as it appeared in the past.
(And, once you know a commit hash prior to the move, you can use "gitk 5a0d9820ac6bd4068a1fa3075d45904ed5341675" to view that revision and its history, just like you can with SVN.)
I do not think that one should ever have to know some abstruse commit number in order to see the history of a file in a repository.
There seems to be some amount of misinformation/confusion in this thread, so here's an example:
== Create the repository.
~ $ mkdir file
~ $ cd file/
~/file $ git init
Initialized empty Git repository in ~/file/.git/
~/file (master #) $ git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
== Add a file and make a series of commits with changes to it.
~/file (master #) $ echo "line 1" >> file.txt
~/file (master #%) $ git add file.txt
~/file (master #) $ git ci -m "line 1"
[master (root-commit) d29d848] line 1
1 file changed, 1 insertion(+)
create mode 100644 file.txt
~/file (master) $ echo "line 2" >> file.txt
~/file (master *) $ git ci -a -m "line 2"
[master 7c0ee29] line 2
1 file changed, 1 insertion(+)
~/file (master) $ echo "line 3" >> file.txt
~/file (master *) $ git ci -a -m "line 3"
[master c7b1f4c] line 3
1 file changed, 1 insertion(+)
== Move the file to a new name.
~/file (master) $ git mv file.txt other.txt
~/file (master +) $ git st
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: file.txt -> other.txt
#
~/file (master +) $ git ci -m "move file.txt to other.txt"
[master 5e581f3] move file.txt to other.txt
1 file changed, 0 insertions(+), 0 deletions(-)
rename file.txt => other.txt (100%)
== Add another change to the file under it's new name.
~/file (master) $ echo "line 4" >> other.txt
~/file (master *) $ git ci -a -m "line 4"
[master c4a8b48] line 4
1 file changed, 1 insertion(+)
== Run git log, which shows all of the commits.
~/file (master) $ git log
commit c4a8b48fbf38a9b06376b30a36a76b6a674384a9
Author: Ahmed Charles