简体   繁体   English

在远程仓库上使用'git push -f'是否刷新整个文件夹?

[英]Does Using 'git push -f' On A Remote Repo Refresh The Entire Folder?

I have a GIT repo for an application. 我有一个应用程序的GIT存储库。 The application starts a long running process that I want to keep running in the background. 该应用程序启动了一个长时间运行的进程,我想继续在后台运行。

When I make a change to any of the application config files, commit those changes, and then git-push those changes, everything works fine. 当我对任何应用程序配置文件进行更改时,提交这些更改,然后git-push这些更改,一切正常。 The long running process picks up the config changes I've pushed. 长时间运行的过程会拾取我推送的配置更改。

Sometimes though, I make a mistake in the commit history and purge those commits with a rebase. 但是有时候,我在提交历史记录中犯了一个错误,并用重新设置基准清除了这些提交。 I then use git push -f to force the purged changes through. 然后,我使用git push -f强制执行清除的更改。 Doing so kills the long running process. 这样做会杀死长期运行的过程。

Why would that be? 为什么会这样呢?

As I understand it, when I git-push commits, it will only change the lines of code that I have edited. 据我了解,当我进行git-push提交时,它只会更改我已编辑的代码行。

Am I right in thinking that using git push -f instead changes more than just the lines in the commits I've purged? 我是否认为使用git push -f所做的更改不仅仅是我清除的提交行中的更改? I suspect the git push -f command is also refreshing (though not changing) other application files in the repo, if not all of them, and that's why the process dies on a rollback attempt... 我怀疑git push -f命令还会刷新(尽管不更改)存储库中的其他应用程序文件(如果不是全部),这就是为什么该进程在回滚尝试中死掉的原因...

Does anyone have a definitive answer? 有人有明确的答案吗?

Though I still have my suspicions, I think the issue may have just been caused by a careless commit that overwrites the file that the process is based on. 尽管我仍有怀疑,但我认为该问题可能是由于粗心的提交导致的,该提交覆盖了进程所基于的文件。

If I discover anything new (as likely as that might be), then I will update the answer. 如果我发现任何新内容(可能的话),那么我将更新答案。 Thanks for the help. 谢谢您的帮助。

Update : 更新

I'm pretty sure that it's not GIT now. 我很确定现在不是GIT。 It was because the long running process prints out messages to the terminal. 这是因为长时间运行的过程将消息输出到终端。 When I was testing the GIT hook, I always had an SSH terminal open, so the program ran fine. 当我测试GIT挂钩时,我总是打开SSH终端,因此程序运行正常。 But when I closed the terminal and made an upstream push from my remote machine, the application had no terminal to print messages to... 但是,当我关闭终端并从远程计算机向上游推送时,该应用程序没有终端可以将消息打印到...

Doh. h

Accounting for this appears to work. 解决这一问题似乎可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM