![]() ![]() In the second case, and my current case at work, imagine that you’ll be working on a rather large feature. ![]() ![]() An empty commit is a much better candidate than adding some insignificant change to a file just to be allowed to make a commit. So in this case, you might just need to trigger a new build but the codebase doesn’t need to change (imagine that there was an unexpected server error or timeout, or we need to trigger fetching new external data). This is what happens with thread.house, by the way: netlify looks out for new commits in the github repo and rebuilds the site for us with the new content. In the first case, imagine that with every new commit a serverside process or build step is launched. You are starting a new branch for a feature.Why would we want an empty commit, anyway?įor me, there are two really great reasons that you might an empty commit: Notice that git gives you a bit of back talk, informing you about the unstaged changes. Nothing added to commit but untracked files present Your branch is up to date with 'origin/master'. > git commit -m "Made incredible changes XYZ to project" If you tried to create a commit without adding anything to the staging area, you’d get something along the following: What’s worse, in our imagined alternate reality where git trusts you to be thorough, there are no errors, no warnings, and no indication that you did anything out of the ordinary. That sequence should have started by adding the changed files to the staging area using git add, then making the commit, then pushing the changes. But what you forgot was to include anything in the commit, so the remote repository will not be up-to-date with the changes you made locally. Writing objects: 100% ( 1/1 ), 194 bytes | 194.00 KiB/s, done.ĭid you catch what happened? You made a commit with a message, and you pushed it, sure. git commit -m "Made incredible changes XYZ to project" Made incredible changes XYZ to project ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |