Tag Archives: git
Who are you writing that commit message for?
Next time you write a commit message, try some of these suggestions as your imaginary audience:
- Yourself, next week, when you finally get back to working on this thing and can’t remember where you were up to
- Yourself, when you get a pull request review and can’t remember which commit something is in that needs to be removed
- Yourself, debugging how this ended up like this, 6 months from now
- Your colleague, eyeballing your work to see how you are getting on
Personally, I think of it as a note to myself. Like an alibi, if someone asks you what’s already been done, or what this commit that removes one specific line from a long config file. Yes, I worked as a git consultant for a while, the delete-a-single-line with the commit message “Fixed” is always the culprit!
Further reading: https://cbea.ms/git-commit/
Remove Accidental Content from Git Commit
node_modules directory in your otherwise excellent and useful commit. This post will walk you through how to fix the problem without losing any of your work. Continue reading Counting Duplicate Commit Messages
How NOT to Review a Pull Request
Updating Local Git Repos When Upstream Moves
svn switch command and git has an equivalent. It’s relatively easy in git to change your upstream – once you know how – so don’t be tempted to just delete your local repo and re-clone! We can do better than that :) Continue reading Surviving Git Submodules
Git Won’t Check Out A Path It Autocompleted
PHP Learning Path from O’Reilly
I think it’s a pretty well-rounded collection and it’s only $99 for a couple of weeks, so get the PHP Learning Path here and let me know what you think?
Git Pull Causes a Merge
git pull and expect a fast-forward update, but get a merge instead, don’t panic! This usually happens when we’re collaborating on a branch with other people, and we’ve made changes on our local version of a branch, and someone else (or the other you, if you use git to sync between multiple dev platforms) has made changes to the remote version of a branch in the meantime. It also happens really frequently in teams where all commits are to the master branch … yet another reason to have a decent branching strategy.
All that’s happened is something like this:
$ git log --oneline --all --graph --decorate * 054f163 (HEAD, branch1) Installation instructions for the application | * 0ce808c (origin/branch1) Fixing template layout |/ * 927aad9 A random change of 731 to ideas2.txt
Since the last common commit, there are commits on your local branch, and the remote one. You could just let the merge go ahead but there are other options. You could also check out a new branch at this point, reset your tracking branch to the right place and then reapply your changes using cherry-pick or by rebasing and then fast-forward merging your branch. Continue reading
