You seem to be fixated on wanting to do it in Subversion mode. I can understand that; changing development habits can be a long process, and to some extent it may be better to bend tools for your own habits; it's fine. So, let's go:
Think of it this way: with svn you have one big directory tree where the “branches” are not first class entities, but (technically) arbitrary subdirectories
mystuff/trunk mystuff/branches/feature1 mystuff/branches/feature2 ... mystuff/tags/1.0 mystuff/tags/1.1 ...
So, if you use this and are happy with it, then the same solution is possible with git , checking different copies of the repository with one (not git) parent:
mystuff/master mystuff/master/.git mystuff/feature1 mystuff/feature1/.git ...
This is conceptually exactly the same as before. You constantly keep different repositories in your respective branch. You will have a common ancestor that, as usual, will push / pull in / out to merge (note that this can be processed locally, it does not need a physically remote location, if you do not have one, you can also / theoretically use the master repository directly as origin ).
What you don’t get, and will never succeed with git , makes changes in different branches at a time (under one “commit”). A "branch" in git is a fundamentally different thing than in Subversion, the same thing as a "commit" in git is fundamentally different here (commit! = Revision). You will have to wrap your head around it, not a single tool will save you from this.
Some operations:
Create a new feature2 function feature2 (starting with master ):
mystuff> git clone {URL-or-filesystem-path-of-common-origin-repository} feature2 mystuff/feature2> git checkout -b feature2
Combine your work with a branch on master :
mystuff/feature1> git add ... ; git commit ... mystuff/feature1> git push mystuff/master> git fetch mystuff/master> git merge origin/feature1
The same goes for any other mergers; the master branch is technically no different from any other branches in git , it's just a naming convention (for example, /trunk is a naming convention in Subversion).
Get rid of the branch:
mystuff/feature1> git push origin :feature1
All this requires more hard disk storage than necessary; There are advanced methods for local cloning of the repository, reuse of object storage. Let me know in the comments if this is important to you; if you really have no space limitations, I honestly would not bother.
Anoe
source share