Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine local Git commits into one commit for git-svn

Currently, when I run git svn dcommit git creates a separate commit in SVN for every local commit I've made since last syncing with SVN. Is there any way for dcommit to instead combine all my recent local commits into one commit for SVN?

like image 525
MacRae Linton Avatar asked Sep 11 '09 00:09

MacRae Linton


People also ask

How do I merge two local commits?

If you want to merge the last 2 commits into one and look like a hero, branch off the commit just before you made the last two commits (specified with the relative commit name HEAD~2). That will bring in the changes but not commit them. So just commit them and you're done.

Can you use Git and SVN together?

git-svn is a specialized tool for Git users to interact with Git repositories. It works by providing a Git frontend to an SVN backend. With git-svn, you use Git commands on the local repository, so it's just like using normal Git. However, behind the scenes, the relevant SVN commands are sent to the server.

How do you squash last n commits into a single commit in git?

Git's interactive rebase will list all relevant commits in the default editor. In this case, those are the commits we want to squash. Then we can control each commit and commit message as we want and save the change in the editor. Next, let's squash the last four commits.


1 Answers

git rebase remotes/trunk --interactive  

should bring you to the menu where you can pick commits or squash them all into 1 commit in order to avoid polluting your svn repository. This is a really good (but short) resource on working with git-svn.

like image 97
Jason Punyon Avatar answered Sep 17 '22 15:09

Jason Punyon