Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 641ee08

Browse files
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)

AltStyle によって変換されたページ (->オリジナル) /