Skip to content

Instantly share code, notes, and snippets.

@leonhandreke
Created December 18, 2009 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonhandreke/259489 to your computer and use it in GitHub Desktop.
Save leonhandreke/259489 to your computer and use it in GitHub Desktop.
Leon@stockholm /Users/Leon/Development $ mkdir lol
Leon@stockholm /Users/Leon/Development $ cd lol
Leon@stockholm /Users/Leon/Development/lol $ ls
Leon@stockholm /Users/Leon/Development/lol $ git init
Initialized empty Git repository in /Users/Leon/Development/lol/.git/
Leon@stockholm /Users/Leon/Development/lol $ touch file.c
Leon@stockholm /Users/Leon/Development/lol $ git add file.c
Leon@stockholm /Users/Leon/Development/lol $ git commit -a -m "Initial Import"
[master (root-commit) ca7eeae] Initial Import
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file.c
Leon@stockholm /Users/Leon/Development/lol $ emacs file.c
Leon@stockholm /Users/Leon/Development/lol $ git commit -a -m "Made a change"
[master 5407373] Made a change
1 files changed, 1 insertions(+), 0 deletions(-)
Leon@stockholm /Users/Leon/Development/lol $ ls
file.c
Leon@stockholm /Users/Leon/Development/lol $ mkdir rofl
Leon@stockholm /Users/Leon/Development/lol $ git mv file.c rofl
Leon@stockholm /Users/Leon/Development/lol $ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: file.c -> rofl/file.c
#
Leon@stockholm /Users/Leon/Development/lol $ git commit -a -m "Moved file.c to a new directory"
[master 7a39776] Moved file.c to a new directory
1 files changed, 0 insertions(+), 0 deletions(-)
rename file.c => rofl/file.c (100%)
Leon@stockholm /Users/Leon/Development/lol $ git log
commit 7a39776b146646d0efb896aae080910152522b8c
Author: Leon Handreke <leonbrussels@gmail.com>
Date: Fri Dec 18 14:14:02 2009 +0100
Moved file.c to a new directory
commit 540737375646d38ae4759598c4330776a4598158
Author: Leon Handreke <leonbrussels@gmail.com>
Date: Fri Dec 18 14:13:21 2009 +0100
Made a change
commit ca7eeae658329cf8544c9ad8f9746612466a8189
Author: Leon Handreke <leonbrussels@gmail.com>
Date: Fri Dec 18 14:12:47 2009 +0100
Initial Import
Leon@stockholm /Users/Leon/Development/lol $ git log rofl/file.c
commit 7a39776b146646d0efb896aae080910152522b8c
Author: Leon Handreke <leonbrussels@gmail.com>
Date: Fri Dec 18 14:14:02 2009 +0100
Moved file.c to a new directory
Leon@stockholm /Users/Leon/Development/lol $ git log --follow rofl/file.c
commit 7a39776b146646d0efb896aae080910152522b8c
Author: Leon Handreke <leonbrussels@gmail.com>
Date: Fri Dec 18 14:14:02 2009 +0100
Moved file.c to a new directory
commit 540737375646d38ae4759598c4330776a4598158
Author: Leon Handreke <leonbrussels@gmail.com>
Date: Fri Dec 18 14:13:21 2009 +0100
Made a change
commit ca7eeae658329cf8544c9ad8f9746612466a8189
Author: Leon Handreke <leonbrussels@gmail.com>
Date: Fri Dec 18 14:12:47 2009 +0100
Initial Import
Leon@stockholm /Users/Leon/Development/lol $ git checkout ca7eeae658329cf8544c9ad8f9746612466a8189 rofl/file.c
Leon@stockholm /Users/Leon/Development/lol $ cat rofl/file.c
This is a test
Leon@stockholm /Users/Leon/Development/lol $ git log rofl/file.c
commit 7a39776b146646d0efb896aae080910152522b8c
Author: Leon Handreke <leonbrussels@gmail.com>
Date: Fri Dec 18 14:14:02 2009 +0100
Moved file.c to a new directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment