Skip to content

Commit 641ee08

Browse files
authored
Squash all commits in a branch to a single commit
1 parent daf558a commit 641ee08

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ git config --global delta.side-by-side true
381381
# Find which commit added a specific file eg foo.cpp
382382
# https://stackoverflow.com/q/11533199
383383
git log --follow --diff-filter=A --find-renames=40% foo.cpp
384+
385+
# Squash all commits in a branch to a single commit without git rebase
386+
# https://stackoverflow.com/a/25357146
387+
git checkout my_branch
388+
git reset $(git merge-base main $(git rev-parse --abbrev-ref HEAD))
389+
git add .
390+
git commit -m "one commit to rule them all
391+
384392
```
385393
386394
[Atlassian Git Tutorials](https://www.atlassian.com/git/tutorials)

0 commit comments

Comments
 (0)