Git tips
Originally published
Last modified
See also: git dotfiles
The best tip is to learn your tools. Git is a beast of a tool, and if you don't spend some time trying to learn it, you will inevitably waste your own time because you didn't know the best way to do something.
Git commit message guidelines
Write good commit messages. Show some craftsmanship and have some pride in your work.
This blog post explains git commit message best practices in detail: https://chris.beams.io/posts/git-commit/
Copying the summary:
The seven rules of a great Git commit message
Sending a repository to someone without a git server
Create a bundle:
git bundle create repo.bundle --all
Send the bundle to the recipient
Recipient clones the bundle
git clone repo.bundle
Resetting the commit date of unpushed commits to now
This is destructive, so understand how to get back to your current state before trying!
git rebase -i
and set all the commits to editwhile [[ -e .git/rebase-merge ]]; do git commit --amend --date=now --no-edit && git rebase --continue; done
git add -p
and untracked files
git add -p
doesn't work with untracked files- Use
git add --intent-to-
add; an empty version of the file will be staged sogit add -p
works