git squash multiple commits to single commit after push
This post is about how to squash (combine) multiple commits to a single commit in GIT.
Checkout the code from the GIT Repo.
For example, there are 4 Commits done earlier and if we want to merge into single commit.
For that,
Now all the different commits will be merged into a single commit.
Reference:
http://stackoverflow.com/questions/5667884/how-to-squash-commits-in-git-after-they-have-been-pushed
This post is about how to squash (combine) multiple commits to a single commit in GIT.
Checkout the code from the GIT Repo.
git clone <URL OF THE REPO>
Now run git status
This will show the branch in which the repo is cloned currently.For example, there are 4 Commits done earlier and if we want to merge into single commit.
For that,
git checkout my_branch
git reset --soft HEAD~4
After this, git diff of the modified files w.r.t. to 5th Commit will
be shown separately. Which ever files we wish to be included in GIT, can
be added using the
git add <Files>
git commit
git push --force origin my_branch
Now all the different commits will be merged into a single commit.
Reference:
http://stackoverflow.com/questions/5667884/how-to-squash-commits-in-git-after-they-have-been-pushed
No comments:
Post a Comment