문제

에 따르면 매뉴얼, git dcommit "GIT의 각 커밋마다 SVN에 개정을 만들 것입니다." 그러나 여러 개의 전복 개정을 피할 수있는 방법이 있습니까? 즉, GIT가 수행하기 전에 모든 변경 사항을 병합하도록합니다. svn commit?

도움이 되었습니까?

해결책

Git의 지점에서 일하는 경우 git-merge --squash, 그것은 git 내에서 그것을 수행합니다. 그런 다음 한 번의 스쿼시 커밋을 SVN에 밀어 넣을 수 있습니다.

물론, 많은 작은 커밋이 좋으므로 왜 그들을 스쿼시하고 싶습니까?

다른 팁

The command git rebase -i can do this, and more. This command is extremely powerful, so it's good to make friends with it.

The syntax is: git rebase -i <commit ID>. This brings up your text editor, with options (and instructions) for modifying all the commits up to (not including) the given ID.

For example, to modify the previous 5 commits, you can do this:

git rebase -i HEAD~5

Or if your SVN branch is called "svn/trunk", then this syntax is good too:

git rebase -i svn/trunk

Then a text editor window will pop up. To squash everything, change the first word of every line after the first from "pick" to "squash" (If this sounds confusing- it will make more sense when you see it). Then save and close the editor. You'll then have a chance to edit the commit message for the squashed commit.

Among the other things you can do with git rebase -i, are reordering commits, squashing commits in different ways, and removing commits.

I use this command constantly; it's a killer feature of Git.

Ryan Tomayko wrote a bit about git rebase -i, which he said:

…[it's] a bit like git commit --amend hopped up on acid and holding a chainsaw – completely insane and quite dangerous but capable of exposing entirely new states of mind. Here you can edit, squash, reorder, tease apart, and annotate existing commits in a way that’s easier and more intuitive than it ought to be.

I have a tendency to commit often in git, but don't necessarily want to dcommit every commit to svn, and squashing all my work makes just as little sense. I'm trying it now to reorder and squash a few together into more logical commit units now.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top