Squashing
What is "Squash and Merge" and why we use it
Non-linear history
$ gitlog
# * (HEAD -> main) 096c148 Added a README
# * c5ac38c Added a comment
# * 92eca49 Added __pycache__/ to gitignore
# * f53d7d2 Moved the greeting message to data.py
# * e96ab34 Added Hello World# Add commits to a new branch, branch1
$ git switch -c branch1
$ echo This is file 1 > file1.txt
$ git add file1.txt
$ git commit -m "Added file 1"
$ git switch main
# Add commits to a new branch, branch2
$ git switch -c branch2
$ echo This is file 2 > file2.txt
$ git add file2.txt
$ git commit -m "Added file 2"
$ git switch main
# Merge the branches into main
git merge branch1 -m "Merge branch 1"
# Updating 096c148..f3399a7
# Fast-forward (no commit created; -m option ignored)
# file1.txt | 1 +
# 1 file changed, 1 insertion(+)
# create mode 100644 file1.txt
git merge branch2 -m "Merge branch 2"
# Merge made by the 'ort' strategy.
# file2.txt | 1 +
# 1 file changed, 1 insertion(+)
# create mode 100644 file2.txtMerging main into your feature branch
Rebasing
More Resources
Last updated