|
Lifecycle of a Git fileA file in git goes through the following stages: ![]() git add puts a snapshot of the file to the staging area. Further modification to the file will not be committed with git commit unless a git add is done again. git diff compares local file to the staged file. git diff --staged compares staged file to the committed file. => if you have staged all your changes, then git diff will give no output but git diff -- staged will show you all the changes. Removing a filerm foogit rm foo git commit foo If you accidentally staged a file, it can be removed from the staging area by git rm --cahced foo This keeps the file in your local directory but removes it from staging area. Moving a filegit mv src.txt dest.txtgit considers moving a file as renaming a file. This is useful because the file history is preserved on rename. |
Got a thought to share or found a
bug in the code?
We'd love to hear from you:
Name: | |
Email: | (Your email is not shared with anybody) |
Comment: |
Facebook comments: