推动而不承诺 [英] Pushing without committing
问题描述
我有一个git仓库,我只是把它推到一台服务器上。然后我在服务器上设置一个post-receive钩子。我想检查它的作品。我必须再次提交才能看看它是否有效?我真的很想在我尝试建立这个设置时强制推送,而不是继续进行没有实际价值的提交。它不工作,我只是不明白。
I have a git repo and I just pushed it to a server. Then I setup a post-receive hook on the server. I want to check it works. I have to commit again just to see if it works? I would really like to just force a push while I'm trying to get this set up rather than keep making commits that have no real value. Its not working, and I just don't get it.
$ git push --force origin master
Everything up-to-date
推荐答案
致力于实现这一点。例如,您可以使用此注释在当前HEAD之前推送提交权:
You need to push an older commit to achieve this. For example, you could push the commit right before the current HEAD using this comment:
git push --force origin HEAD^:master
之后,您可以再次推送HEAD提交:
After this you can push the HEAD commit again:
git push origin master
然而,推动所有的时间考虑手动调用挂钩。这通常更容易 - 但不要忘记在实际推动时进行测试,当你认为一切正常时都可以。
However, instead of pushing all the time consider calling the hook manually. That's usually easier - but don't forget to test with an actual push when you think everything works just to be sure.
这篇关于推动而不承诺的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!