git checkout
Force re-checkout with LF line endings
git config --global core.eol lf
git config --global core.autocrlf input
git rm -rf --cached .
git reset --hard HEAD
This will delete (rm
) recursively (r
) without prompt (-f
), all files except those that you have edited (--cached
), from the current directory (.
). The reset then returns all of those files to a state where they have their true line endings (matching what's in the repo).
Reference: https://stackoverflow.com/a/33424884/1955346
git tag
show tags with hash
git show-ref --tags
show tags with messages
git tag -ln
create tag
git tag -a 1.0.0 -m "Tag message" <<SHA-1 HASH or HEAD>>
remove local tag & remove remote tag
git tag --delete tagname
git push --delete origin tagname
git-crypt
Encrypt whole folder with local .gitattributes
.gitattributes
in the dir you want to encrypt:
* filter=git-crypt diff=git-crypt
.gitattributes !filter !diff
git config
Show config path (.gitconfig)
git config --list --show-origin
git log
Find file in the whole history
Shows all commits which affected the file. Supports wildcards:
git log --all --full-history -- *.myfile
git branch
Remove remote branch
git push origin --delete branch-to-delete
git rebase
Change author of an old/specific commit
1. git rebase -i --root # or without --root but point to the commit you want to rebase
2. Mark the commit as `edit`
3. Once at interactive rebase stage, do `git commit --amend --author="yolo <xd@example.com>"
4. `git rebase --continue`
5. Done.
Change author of all commits
git rebase -r --root --exec "git commit --amend --no-edit --reset-author
git commit
Change date of last commit to current date
git commit --date=now --amend
No matches...