[Update]
For more details, The reason that why I try to do pure Git at home is that, my company would like to move to Git but manager won't like to make change because developer don't have knowledge with Git on our own repository. So, what I try to do is, I try to make everyone use Pure git while someone can merge back to Subversion during this learning phase. So, in any emergency case, they can still using Subversion.
So, before everyone familar with Git, I cannot transfer repository to use pure Git. So, it will have both update on Subversion and Git. (and Main repository right now is Subversion). So, I try to make the way that Git can working smoothly during I have sync repository by dcommit back to Subversion.
[Question]
I am in the organization which use Subversion as repository, so I dump it as my personal Git (and plan to use replace Subversion with Git in the future)
Now, I have repository that use both Git and Subversion (Main Source). I have a problem to deal with git svn rebase when I have to use both git and subversion.
My Workflow is like below
At Office
- The Repository have Git-svn interface
- I always commit the code to Subversion with git svn dcommit from here.
- I push to my remote git repository at Bitbucket
At Home
- I clone the repository from Bitbucket
- Working with and commit to Bitbucket
Now, Back to OFfice
- git pull
- git svn rebase
- git svn dcommit
- git push
In step 4. I have a problem that I already rebased my branch
Problem now here, when I am back home
When I come back home, I cannot use 'git fetch' because the branch is already rebased. So, I have to remove branch with git branch -D ..... and then git checkout again.
So, I look for the way that we can concurrent use both Git repository and Subversion and do going well with Git after done operation with git svn rebase or git svn dcommit.
Note. I won't prefer to use any git-svn at home. Try to move forward to use only Git.
You can clone a subversion repository to your machine using git svn clone <SVN repo URL> . The code will be available as a git repository. You can do your work there and make local commits as you please. There is a command line option to get a "shallow" checkout rather than the entire repository which is often useful.
SVN stands for Subversion. So, SVN and Subversion are the same. SVN is used to manage and track changes to code and assets across projects.
I assume the main cause of your problem is that git svn dcommit
changes the commit message to include the SVN commit data. As the message is included in the SHA1 of a commit this change appears to git as a totally different commit.
My solution for that would be to have one branch at your office repo which you sync with SVN and another (purely git) branch to do your work in. Whenever you want to exchange something with the SVN repo you do a merge in one or the other direction.
In my case I've set up another git repo dedicated solely for SVN exchange. I have a cron job which syncs that repo every 15 minutes with the SVN server. This way I don't miss a git svn rebase
.
Okay, your main problem here seems to be that you can't really do a git pull
from home has the history has been rewritten (actually it should work but it would try to do an unnecessary merge).
The easiest way to get past that issue would be using git pull --rebase
. This way, instead of merging the commits you've made at home with the tip of your remote branch, you rebase every commits done since your branch creation on the tip of the branch. Git will be smart enough to see that some commits are exactly the sames and they will be automatically be pruned during the rebase.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With