Skip to content

Latest commit

 

History

History
50 lines (30 loc) · 1.74 KB

git.md

File metadata and controls

50 lines (30 loc) · 1.74 KB

Git

  • Squash commits before push
  • Rebase instead of merge
  • One line to describe the commit, details two lines above
  • Specify user story id (or track id used) like #2212

Example:

Add user profile

Enable feature flag in configuration
User story #2212 

Squash commits with interactive rebase - SourceTree

This is the most effective way in SourceTree to squash our commits. All we need to do is follow the steps below.

  1. Squashing commits is a destructive operation in the branch and we need to force push. This option is disabled by default but can be enabled in Tools -> Options -> Git.

    Step 10

  2. Click the right mouse button in the previous commit and select interactive rebase.

    Step 1

  3. Select the last commit and click in squash with previous until there is only one.

    Step 2

  4. When there is only one commit, the commit message can be changed for a more descriptive one:

    Step 3 Step 4 Step 5

  5. Commits are already squashed. Now the process finish clicking in the Ok button.

    Step 6

  6. Then, there are 2 commits to pull and one to push... why? It is because we have previous commits in the origin and the new squashed one in local. We click in the Push button.

    Step 7

  7. And to finish squash select Force Push and click in the Push button. In the dialog select Yes (see step 0).

    Step 8 Step 9