Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat git commit practice is better?
    text
    copied!<p>I truly believe that to have one commit on one issue is a good practice. I'm sure I read it somewhere in an article like “Best practices”. </p> <p>As such, my workflow has been the following:</p> <ul> <li>For a new issue, I create a new local branch with <code>git checkout -b new-issue</code>.</li> <li>Commit all changes into it. Sometimes this involves <em>lots</em> of commits.</li> <li>When done, I <code>squash</code> the commits and <code>rebase</code> them into current thematic branch.</li> <li>If something goes wrong, I can <code>git revert</code> the commit, find the bug, fix it, and commit new patch into the thematic branch. I won't change the remote repository’s history.</li> </ul> <p>But today, I was surprised to hear the following workflow:</p> <ul> <li>Create new branch for the new issue.</li> <li>Commit everything into it.</li> <li>Use <code>merge --no-ff</code> to merge the issue branch with thematic branch (so we’ll have “merge-commit” that we can <code>revert</code>).</li> <li>If something goes wrong, we can use <code>git bisect</code> to find the bug.</li> </ul> <hr> <p>According to the 1st approach, we’ll have a clean git history, and no idea about overhead branches used during development.</p> <p>According to the 2nd approach, we’ll have a very messy history, with a lot of ugly, unnecessary merges and commits for just one issue. However, we can use <code>git bisect</code> to find bugs. (Perhaps this is better for refactoring?)</p> <hr> <ul> <li><p>What pros and cons do you see for both approaches? </p></li> <li><p>Which approach do you use, and why?</p></li> <li><p>In practice, have you actually used <code>git bisect</code> to find bugs? (I haven't…)</p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload