3 ms·
Could someone give me a usecase for when an empty commit might be useful?
by lubomir 13y ago
Could someone give me a usecase for when an empty commit might be useful?
- daGrevis 13y agoTo tell CI (for example, Jenkins) to rebuild.
- reledi 13y agoYou can often trigger a rebuild for such services via their web UI.
- epidemian 13y agoTo make a commit to a Gist look the same as changes done through the web interface. Edit: sorry, i was thinking about --allow-empty-message, not --allow empty.
- davej 13y agoAnnotating the start of a new bulk of work or a new feature. Documenting when you make changes to the project that aren't code related, e.g. "Now using GitHub for issue tracking, closes #1". Communicating with people using your repo, e.g. "Merry Christmas y'all, I'm away for three weeks, if you have any questions please contact Jim". I'm not saying doing any of these things is good practice but they are use-cases for when an empty commit might make sense.
- nahname 13y agoOpening a PR to discuss a new feature before it is built.
- bnferguson 13y agoI use this constantly. Building a PR up with lot of people watching and involved is pretty amazing. Certainly don't need to all the time, but when working on something sensitive or still ambiguous it's invaluable. So many of my PRs have 50-70 comments by the time they go in. Amazing review at every step of the way.
- roryokane 13y agoYou can also do that by just creating an Issue, and then converting it to a Pull Request later with `hub pull-request -i <existing-issue-num>`, when you actually have some code to commit. That uses the software Hub, mentioned in the cheat sheet. Or instead of installing Hub, you can convert the Issue using one of the other methods listed in http://stackoverflow.com/q/4528869/578288 http://stackoverflow.com/q/4528869/578288.
- reledi 13y agoI don't recommend converting issues to Pull Requests. See the discussion here which goes into details: https://github.com/github/hub/commit/4f70dd126f46dec14fc341c97c18efae417743c7 https://github.com/github/hub/commit/4f70dd126f46dec14fc341c...
- reledi 13y agoFantastic suggestion! I always disliked opening a PR after my first code change. Will definitely start using this :)
- raju 13y agoI usually initialize my git repos with an empty commit. Several reasons why this is a good idea (detailed in this blog post - http://kevin.deldycke.com/2010/05/initialize-git-repositories/ http://kevin.deldycke.com/2010/05/initialize-git-repositorie...) I have a git alias for the same - start = !git init && git commit --allow-empty -m \"chore: empty initial commit\" Note: That's not my blog.