Branching Workflow in Git-SVN Mode
As you might already know branches are primary power of Git. You should create branch for every task you working on. Even if it is something small you easily starting to get a good habit of creating branches, since they keep you much in isolation. So, how to deal with branches in Git-SVN mode? It is really easy and conforms to common git practices.
So, as you cloned the SVN repo you have master branch (or several masters, if you did more switches). Suppose you need to start to work on ticket ND-177.
- Create new branch for ND-177 (I call new branch like, original_branch-branch_name)
git checkout -b master-nd-177
- Do your work here, performing as many commits as you need
get commit -a -m "some intermediate commit.."
- Now, as you are ready to be merged you to SVN, you checkout and rebase master (to get latest SVN changes from it)
git checkout master
git svn rebase
- You can simply merge 2 branches, but with simple merge you will get all commits history that you probably don’t need in SVN at all. You squash to compress number of commits into one nice looking commit object
git merge --squash master-nd-177
- It would merge up all changes from master-nd-177 into master. All you need to do is commit
git commit -m "ND-177 completed"
- And dcommit changes to SVN server
git svn dcommit
That’s six basic steps makes really straightforward workflow for everyday usage.
As you might already know branches are primary power of Git. You should create branch for every task you working on. Even if it is something small you easily starting to get a good habit of creating branches, since they keep you much in isolation. So, how to deal with branches in Git-SVN mode? It is really easy and conforms to common git practices.
So, as you cloned the SVN repo you have master branch (or several masters, if you did more switches). Suppose you need to start to work on ticket ND-177.
- Create new branch for ND-177 (I call new branch like, original_branch-branch_name)
- Do your work here, performing as many commits as you need
- Now, as you are ready to be merged you to SVN, you checkout and rebase master (to get latest SVN changes from it)
- You can simply merge 2 branches, but with simple merge you will get all commits history that you probably don’t need in SVN at all. You squash to compress number of commits into one nice looking commit object
- It would merge up all changes from master-nd-177 into master. All you need to do is commit
- And dcommit changes to SVN server
git checkout -b master-nd-177
get commit -a -m "some intermediate commit.."
git checkout master git svn rebase
git merge --squash master-nd-177
git commit -m "ND-177 completed"
git svn dcommit
That’s six basic steps makes really straightforward workflow for everyday usage.