当我运行此Bash脚本时
#!/bin/bash
cd /srv/http
unset GIT_DIR
git commit -am "design changes"
git push -u origin master
git checkout dev
git merge master
git commit -am "design changes"
git checkout master
通过命令行,我得到了这个输出
[master 914422f] design changes
1 file changed, 17 deletions(-)
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 334 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To https://blah@bitbucket.org/blah/blah.git
562207f..914422f master -> master
Branch master set up to track remote branch master from origin.
Switched to branch 'dev'
Updating 562207f..914422f
Fast-forward
save-design | 17 -----------------
1 file changed, 17 deletions(-)
On branch dev
nothing to commit, working directory clean
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
但是当我使用
运行Python时subprocess.check_output('./save-design', shell=True)
我得到了这个输出
M save-design
Already up-to-date.
M save-design
Your branch is up-to-date with 'origin/master'.
为什么会这样?
答案 0 :(得分:0)
我仍然不知道为什么会这样,但我通过sshing到localhost来修复它:
subprocess.check_output('ssh localhost "/srv/http/save-design"', shell=True)