开发者

shell script for automated git svn rebase, push to github

开发者 https://www.devze.com 2023-03-07 05:03 出处:网络
I\'m trying to set up a shell script (eventually to be run as a cron job) to automatically do a git svn rebase and then push the results to a github repository. Here\'s what I have now:

I'm trying to set up a shell script (eventually to be run as a cron job) to automatically do a git svn rebase and then push the results to a github repository. Here's what I have now:

#!/bin/sh

export PATH=/sw/bin:$PATH
cd ~/Projects/FieldTrip

git checkout svnMirror
git svn rebase
git push github svnMirror
git checkout master
git merge svnMirror

The problem is, it performs the checkout and rebase, but it doesn't any of the steps after those ones:

$ fieldtrip_rebase.sh 
Switched to branch 'svnMirror'
Current branch svnMirror is up to date.
Everything up-to-date
Switched to branch 'master'
Your branch is ahead of 'github/master' by 7 commits.
Already up-to-date.开发者_如何学JAVA

Any idea why that may be?


Let us follow the steps and output:

git checkout svnMirror

you got Switched to branch 'svnMirror' - Good

git svn rebase

you got Current branch svnMirror is up to date. - Good

git push github svnMirror

you got Everything up-to-date - Good. So you had nothing to push. Then it continues...

git checkout master

you got Switched to branch 'master'.Your branch is ahead of 'github/master' by 7 commits.

git merge svnMirror

you got Already up-to-date. There is nothing to merge from svnMirror branch.

It has done all that you wanted it to do. Note, it is master that is ahead of github/master by 7 commits and you are not pushing it.

0

精彩评论

暂无评论...
验证码 换一张
取 消