Last active
February 20, 2021 13:49
-
-
Save lexthor/0820ade39a4ef84c9a8e85542acd8b49 to your computer and use it in GitHub Desktop.
Git-Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make an Archive to ftp to hostprovider: | |
git archive HEAD --format=zip > archive.zip | |
To export the repository up to a certain commit: | |
git archive -o export.zip <COMMIT> | |
Delete (uncommitted) changes: | |
git reset --hard 0d1d7fc32 | |
Delete untracked files AND directories from current git branch: | |
git clean -f -d --dry-run | |
git clean -f -d | |
Amend a commit message | |
git commit --amend -m "New commit message" | |
Show last 3 entries of log | |
git log -3 | |
Show difference of a specific file to a specified commit: | |
git diff 7bc384 myfile.txt (also git diff HEAD myfile.txt) | |
Show ignored files in git | |
git clean -ndX | |
Ignore files that have already been committed to a Git repository | |
First commit any outstanding code changes (else you will lose them) | |
git rm -r --cached . | |
git add . | |
git commit -m ".gitignore is now working" | |
Using git add for deleted files | |
One slightly annoying thing about git add is that it does not take into account deleted files. Typically, git would like you to use git rm to delete files, but in practice, using command line or IDE you are likely to delete files using traditional methods. | |
To add deletions to the index, a handy shortcut is git add -A, which tells git to add all files it knows about, including deletions. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment