git
Snippets
Set your commit email address in Git (source):
$ git config --global user.email "[email protected]"
Undo your most recent commit (source):
$ git commit -m "Something terribly misguided"
$ git reset HEAD~
<< edit files as necessary >>
$ git add ...
$ git commit -c ORIG_HEAD
Move an existing submodule within the same git repository (source):
git mv old/submod new/submod
Resolve a detached head (source):
git branch temp # base new branch on detached head
git checkout master
git merge temp
git branch -d temp
Make an empty commit (good for debugging CI):
git commit --allow-empty -m "Empty commit to trigger post_receive hooks"
Initialize all submodules recursively (source):
git submodule update --init --recursive
Links
Conventional Commits - "A specification for adding human and machine readable meaning to commit messages"
Dangit, git! - "Git is hard: screwing up is easy, and figuring out how to fix your mistakes is nigh on impossible. Git documentation has this chicken and egg problem where you can't search for how to get yourself out of a mess, unless you already know the name of the thing you need to know about in order to fix your problem."
Git-cherry-pick #article - “Apply the changes introduced by some existing commits”
Applying git commits to working tree unadded? #article
git cherry-pick --no-commit 4..8
Git housekeeping tutorial: clean-up outdated branches in local and remote repositories #article - “After working with branch per feature for a while any Git-repository becomes a mess of outdated and not finished branches. To deal with this issue, we need to clean-up three kinds of branches…”
GitHub Desktop #software - "Focus on what matters instead of fighting with Git. Whether you're new to Git or a seasoned user, GitHub Desktop simplifies your development workflow."
GitKraken #software - “The legendary Git GUI client for Windows, Mac and Linux”
GitUp #software - “Work quickly, safely, and without headaches. The Git interface you've been missing all your life has finally arrived.”
Global Git ignore #article - git config --global core.excludesfile '~/.gitignore'
How to copy commits from one branch to another? #article
git cherry-pick <SHA of commit to cherry-pick>
Husky - "🐶 Git hooks made easy"
Quick Tip: Autocomplete Git Commands and Branch Names in Bash #article - “In bash in Mac OS X, you can use [TAB] to autocomplete file paths. Wouldn’t it be nice if you could do the same with git commands and branch names?”
so-fancy/diff-so-fancy - “Good-lookin' diffs. Actually… nah… The best-lookin' diffs. 🎉”
Undo working copy modifications of one file in Git? #article
git checkout -- file
Last updated