Skip to content

Instantly share code, notes, and snippets.

@lb1a
Created July 27, 2012 09:24
Show Gist options
  • Save lb1a/3187077 to your computer and use it in GitHub Desktop.
Save lb1a/3187077 to your computer and use it in GitHub Desktop.
git example
lb@pluto:~/test$ git init
Initialized empty Git repository in /home/lb/test/.git/
lb@pluto:~/test (master)$ touch foo.txt
lb@pluto:~/test (master)$ git add foo.txt
lb@pluto:~/test (master)$ git cm
[master (root-commit) 65a4e64] initial
0 files changed
create mode 100644 foo.txt
lb@pluto:~/test (master)$ mv foo.txt bar.txt
lb@pluto:~/test (master)$ git add bar.txt
lb@pluto:~/test (master)$ git rm foo.txt
rm 'foo.txt'
lb@pluto:~/test (master)$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: foo.txt -> bar.txt
#
lb@pluto:~/test (master)$ git cm
[master bc642ab] second
1 file changed, 0 insertions(+), 0 deletions(-)
rename foo.txt => bar.txt (100%)
lb@pluto:~/test (master)$ git mv bar.txt baz.txt
lb@pluto:~/test (master)$ git st
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: bar.txt -> baz.txt
#
lb@pluto:~/test (master)$ git cm
[master 6bd23b0] third
1 file changed, 0 insertions(+), 0 deletions(-)
rename bar.txt => baz.txt (100%)
lb@pluto:~/test (master)$ mv baz.txt foobar.txt
lb@pluto:~/test (master)$ git add . -u
lb@pluto:~/test (master)$ git st
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: baz.txt -> foobar.txt
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment