Git via svn - file management

Maybe I missed something for using gi via svn, but how can I get around a set of locally modified files without pushing these changes in subversion.

Here is my broken workflow.

(on master) git svn rebase
git checkout -b issue
*apply changes I need on all my branches*
*changes*
git commit *changes*
git checkout master
git merge issue
git svn dcommit

The problem is that svn rebase or even commit, I am losing locally modified but not verified files. I don’t want to commit files because I don’t want them to get pulled into svn commit.

How should my workflow work in this situation?

+4
source share
3 answers

My git-svn workflow looks something like this:

 (on master) git svn rebase git checkout work ... make commits for all changes, including local-only and those I intend to push up git checkout master ... cherry-pick changes from work branch git svn dcommit git checkout work git rebase master 

The final rebase step removes all commits from the working branch that have already been processed upstream.

For the cherry-pick step, I actually use a small shell script that automatically receives all commits except those that have "NOCOMMIT" in their description. You can use another indicator, such as "LOCAL" or "NOPUSH" or whatever. These commits are those that hang on the "work" branch and do not push towards Subversion.

Here is my pull-work script:

 #!/bin/sh BRANCH=`git branch | grep ^\\* | cut -d' ' -f2` if [ $BRANCH != "master" ]; then echo "$0: Current branch is not master" exit 1 fi git log --pretty=oneline work...master | grep -v -E '(NOCOMMIT|DEBUG):' | cut -d' ' -f1 | tac | xargs -l git cherry-pick 

Pay attention to the use of subtleties such as tac , which change the order of the listed commits so that they are applied to the master in the same order.

+2
source

It looks like what happens is that your HEAD reset. To avoid this, use svn dcommit --no-rebase .

However, I think your workflow is somewhat disrupted. Is it impossible to ignore files for the purpose of defeat, right?

You should probably use git stash . This makes your new workflow:

 (on master) git svn rebase git checkout -b issue *apply changes I need on all my branches* *changes* git commit *changes* git checkout master git merge issue git stash git svn rebase git svn dcommit git stash apply 

Name your stamps appropriately and you can do what you are trying to do.

+2
source

If it is a file that does not exist in the repo, you can always add it (or a template) to

  .git / info / exclude 
. Then it will be ignored in git commits and will never be inserted into SVN.
0
source

All Articles