Reputation: 6146
Let's say I have multiple commits in my local git repository that have not been pushed to svn. For example, these four commits on master.
A <-- B <-- C <-- D
A is the oldest commit not in svn and D is the newest commit.
How do I use git svn dcommit
to only push A and B to svn, but keep C and D only in my local git repository?
Alternate workflows welcome.
Upvotes: 1
Views: 287
Reputation: 6146
I've been thinking about this, and have a potential solution to my own problem.
I can create a local branch for each discrete task I'm working on. If I finish one piece of work and am waiting for a code review, I can create a new branch and start working on an independent task.
When a given task is complete, I run git svn rebase
. I then rebase my local branch on top of master, fast forward master to the head of that branch, then dcommit.
My problem was that commits A and B were part of one task, and C and D were another independent task. C and D belong in a different branch, and never should have been committed on top of A and B.
The answers to this question...
git-svn dcommiting a single git commit
Seem to indicate that only committing A and B isn't really possible.
Upvotes: 1
Reputation: 175735
dcommit
takes an optional argument specifying what to treat as HEAD during commits, so either of these work (where B
is a reference to that particular commit, either by name if it has one or by hash):
git svn dcommit B
git svn dcommit HEAD~2
Upvotes: 3