User Tools

Site Tools


git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
git [2026/06/14 09:08] – [Merge] jhagstrandgit [2026/06/14 09:18] (current) – [Squash Merge] jhagstrand
Line 222: Line 222:
 ==== Squash Merge ==== ==== Squash Merge ====
  
-  Squash merge the feature branch this stages all the changes but doesn't commit yet +The --squash option, the merge command does not really do a merge.  Instead it copies all of the changed files from the feature branch to the master branch.  So now you do a single commit on the master branch, write a commit message summarizing all the individual commits made on the feature branch. 
-  git merge --squash animate+ 
 +This is one of the ways to collapse a developer's many chaotic commits into a single nice-looking well-thought-out commit.  
 + 
 +  # Make sure you're on the branch you want to merge into 
 +  git checkout master 
 +   
 +  # merge the feature branch with --squash option 
 +  this stages all the file changes into the master branch 
 +  git merge --squash feature 
 +   
 +  # ask for status now and you'll see all the changes ready for commit 
 +  git status
      
   # now commit   # now commit
-  git commit -m "feat: add animate command"+  git commit -m "feat: add feature command"
      
   # delete the feature branch   # delete the feature branch
-  git branch -D animate+  git branch -D feature
      
-  # for fun do a log all between these commands to what's going on +  # for fun do a log all between these commands to see what's going on 
   git log --all --oneline -15 --graph --decorate   git log --all --oneline -15 --graph --decorate
  
git.txt · Last modified: 2026/06/14 09:18 by jhagstrand

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki