We use svn, and I use git-svn to maintain sanity. At one point, our svn server decided to return a 403 for a certain folder. It happened to everybody, not just me.
Because of this, I'm unable to do a git-svn rebase. I see this error:
Index mismatch: 164adbb93408bed4ff0bdbcbf07bdfb2c49ed0ce != 64443edc6089f7f737e51cf8ea5ff3680c95a7e9
rereading 0f2fa25d15a35ac3fe311e3e0142f1d9e5a3be18
M test/system-tests/src/test/java/com/garmin/elevation/ElevationManagerSystemTest.java
M test/activity-test/src/test/java/com/garmin/elevation/ElevationManagerIntegrationTest.java
M test/activity-test/src/test/java/com/garmin/mb/activity/service/ActivityServiceManagerIntegrationTest.java
M system/deployment/src/main/resources/oracle/releases/2.9-SNAPSHOT/110-preference/4-data.dml.sql
M pom.xml
service/activity-service-1.2/src/main/java/com/garmin/activity/service/impl/ActivityServiceImpl.java was not found in commit 0f2fa25d15a35ac3fe311e3e0142f1d9e5a3be18 (r8845)
The file that it's complaining about at the end is in the folder that was returning a 403 when we had the error. On my file system, the service/activity-service folder doesn't exist. I believe it's trying to modify the file (that's what the change in svn looks like), but since the file doesn't exist, it just blows up.
So I think if I'm 开发者_运维技巧able to remove past revisions, and then re-fetch them, it might just work. I'm just not sure how to do that. I tried rebasing interactively and then deleting a bunch, but that didn't work.
So, anyone know how to un-fetch already fetched versions?
A better way to do this now is git svn reset -r <rev>
where rev is the revision before where you want to start refetching. After that's done, just run git svn fetch
and it will rebuild its index and refetch the revisions after rev.
First make a backup of your .git directory.
Remove the .rev_map.$UUID
file for the problem branch, below .git/svn
; and rewind the git-svn
-generated branch that represents the problem branch (typically, trunk
). To rewind the branch, run git pack-refs --all
, git log $BRANCH
, find the commit before the problem commit, and edit .git/packed-refs so that the branch now points to the older commit. Then run git svn fetch
. It will rebuild the rev-map from your existing, rewound branch, then fetch the svn commits that you don't have yet, including the problem commit. You should now be able to rebase and dcommit normally.
git svn reset -r <last-good-revision>
(@dOxxx's answer) is simple and works most of the case, except when the commit to re-fetch is the first commit of the branch. @Tobu's answer works even in that case.
This is a bit refined version of @Tobu's. (Difference is that you can use git update-ref
command to edit a ref)
- Backup your
.git
directory - Remove
.git/svn/refs/remotes/<your-svn-remote>/<your-svn-branch>
directory git update-ref refs/remotes/<your-svn-remote>/<your-svn-branch> <last-good-commit>
- Now
git svn fetch
will re-fetch SVN commits after<last-good-commit>
精彩评论