Skip to content

Instantly share code, notes, and snippets.

@zbal
Last active October 4, 2019 01:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zbal/6172020 to your computer and use it in GitHub Desktop.
Save zbal/6172020 to your computer and use it in GitHub Desktop.
rename - delete - create -- git ...
Vincents-MacBook-Pro:sandbox balou$ git init
Initialized empty Git repository in /Users/balou/workspace/sandbox/.git/
Vincents-MacBook-Pro:sandbox balou$ vim a
Vincents-MacBook-Pro:sandbox balou$ cat a
aaaaa
Vincents-MacBook-Pro:sandbox balou$ git add a
Vincents-MacBook-Pro:sandbox balou$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: a
#
Vincents-MacBook-Pro:sandbox balou$ git commit -am 'Add a'
[master (root-commit) c636156] Add a
1 file changed, 1 insertion(+)
create mode 100644 a
Vincents-MacBook-Pro:sandbox balou$ git rm a
rm 'a'
Vincents-MacBook-Pro:sandbox balou$ vim b
Vincents-MacBook-Pro:sandbox balou$ cat b
aaaaa
b
Vincents-MacBook-Pro:sandbox balou$ git add b
Vincents-MacBook-Pro:sandbox balou$ ls
b
Vincents-MacBook-Pro:sandbox balou$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: a -> b
#
Vincents-MacBook-Pro:sandbox balou$ git commit -am 'Deleted a and created b with similar content'
[master add9d5a] Deleted a and created b with similar content
1 file changed, 1 insertion(+)
rename a => b (75%)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment