Am I doing it wrong? SVN merge changes from trunk to git branch. Using merge --squash

We use branches to do our work and maintain most of the cleanliness for the most part. Before changing my changes from my branch to the trunk, I want to make sure that I have the latest changes from svn / trunk in my local branch. I needed to figure it out a bit, but here is the workflow that I came up with, and I would like to know if there is a better way to do this. (In this example, I'm the only one in this thread, so there is no need for git svn rebase for changes in this thread)

git svn fetch
git co -b feature_branch svn / kastner / feature_branch
.... work .... commit ... work ... commit
git svn fetch
git merge svn / trunk --squash
git commit -m 'forward merge of svn / trunk'
git svn dcommit

Reasons why I do this:

  • git merge without squash will add git-svn-id pointing to the trunk, so dcommit clicks there
  • rebasing to svn / trunk will completely remove this branch from the tracks
+3
source share
2 answers

What you are doing here is that you merge the changes from svn / trunk into your git function branch, and then dcommit these changes into the svn equivalent of your function branch. This means that you have a branch in both git and svn, which doesn’t make much sense to me if you work on it alone.

, , svn/trunk . git, trunk, svn dcommit , . ( .)

, , :

git svn fetch
git checkout -b my_branch svn/trunk
...work...commit...work...commit...
git svn fetch && git rebase svn/trunk
...see if it still works
git svn dcommit # commits all of this to svn trunk
+1

, , Subversion . : Git, Subversion , 2000 . Subversion, , .:)

# git svn fetch
# git checkout -b some-feature remotes/trunk
# (work, work, work, commit, commit, commit)
# git svn fetch
# git rebase remotes/trunk
# git checkout master
# git merge remotes/trunk    # updates to latest trunk
# git merge --squash some-feature
# git svn dcommit

, ( ) , Subversion , .

0

Source: https://habr.com/ru/post/1716998/


All Articles