我在我的工作站上有一个本地git仓库,我将其推送到Dropbox位置,以便我可以将其下载到我的笔记本电脑上git pull remote dropbox.
昨天我检查了我的工作站上的更改,提交了它并且git push dropbox编辑了它.我没有git pull从我的笔记本电脑上做一个,因为我怀疑我最终会把这个提交扔掉.
今天我决定抛弃那个提交,所以在我的工作站上我做了:
git reset --hard HEAD~1
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好.现在我想把它推回到Dropbox,这样在我的笔记本电脑上我可以从那里合并和提交.所以在我的工作站上我尝试过:
git push dropbox
Run Code Online (Sandbox Code Playgroud)
而git抱怨说:
![已拒绝] master - > master(非快进)错误:无法将某些引用推送到'\ My Dropbox\dev\repos\xcast.git'为了防止您丢失历史记录,拒绝了非快进更新在再次按下之前合并远程更改(例如'git pull').有关详细信息,请参阅"git push --help"中的"关于快进的注意事项"部分.
如何让我的恶化和Dropbox再次同步?
当我尝试从 VScode 推送到 GitHub 时,我不断收到此错误。我之前已经按照我现在正在遵循的完全相同的步骤推送到该存储库。找不到此错误原因的答案?
我刚刚安装了netbeans并通过ssh连接到我的git存储库.
除了推动主分支外,一切正常.每次我在master分支上进行一些更改并尝试推送分支时,我会得到这个弹出窗口:
There were errors during the push.
Open output to see more details.
Run Code Online (Sandbox Code Playgroud)
细节是
==[IDE]== Jun 30, 2012 4:29:42 PM Pushing finished.
==[IDE]== Jun 30, 2012 4:32:38 PM Pushing
git push ssh://50.57.180.187:22/var/www/netbeans +refs/heads/master:refs/heads/master
Remote Repository Updates
Branch : master
Old Id : cc6de40b3236047b0212e318f9977a7b75395177
New Id : fe8f3af403524ba5731fdf1e0b8773c4ef223840
Result : REJECTED_OTHER_REASON
Local Repository Updates
Branch : origin/master
Old Id : cc6de40b3236047b0212e318f9977a7b75395177
New Id : fe8f3af403524ba5731fdf1e0b8773c4ef223840
Result : NOT_ATTEMPTED
==[IDE]== Jun 30, 2012 4:32:43 PM Pushing finished.
Run Code Online (Sandbox Code Playgroud)
但是对于其他分支机构,一切都很好 难道我做错了什么?
编辑:远程回购不是裸露的,更多信息在这里
我最初尝试推送我的(第一次!)git repo:
$ git push helloworld
Run Code Online (Sandbox Code Playgroud)
但我得到了回报:
To git-smichaels@free5.projectlocker.com:helloworld.git
! [rejected] HEAD -> master (non-fast forward) error:
failed to push some refs to 'git-smichaels@free5.projectlocker.com:helloworld
git'
Run Code Online (Sandbox Code Playgroud)
所以我找到了另一个关于"修改提交"的StackOverflow问题,并从那里尝试了一个建议而不知道它是否会对我有所帮助:
KaiserSosa@SMICHAELS /c/test/helloworld (master)
$ git push helloworld +master:master
Run Code Online (Sandbox Code Playgroud)
有效!
但我不知道为什么它解决了我的问题:(
有人可以解释为什么这有效,但" git push helloworld"不是吗?
我用了
git reset --hard dc082bc...由于一些错误的提交,恢复到分支回到所需的先前状态.这让我当地的分公司很好.但是,我想将'origin'上的分支回滚到同一个commit,以便我可以重新开始.谁能告诉我如何将原始分支(非主人)恢复到此提交?
我已经尝试过git push origin master,但它给出了以下错误
! [rejected] branch -> branch (non-fast-forward) error: failed to push some refs to 'git@github.com:xxx/xxx.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details.
我读到了有关如何修改提交消息的内容.接受的答案是:
如果您已经将提交推送到远程分支,那么您需要强制推送提交
git push <remote> <branch> --force.
这是我的理解(也来自已接受的答案)git push --force将覆盖远程分支上的所有数据与本地数据.
为什么在更改提交消息后强制推送是必要的?如果我修改提交消息并试图在没有-f或者推送的情况下会发生什么--force?
可能重复:
如何将修改后的提交推送到远程git仓库?
撤消git推送
嗨,
我通过使用删除了我的主分支的一些提交
git reset --hard SHA_VALUE
Run Code Online (Sandbox Code Playgroud)
我有一个github上的远程版本的存储库,每当我发现git push错误消息时,我都应该合并远程存储库中包含的更改(我不想这样做).
所以我的问题是,git reset命令的远程等价物是什么?
谢谢
我刚刚推送了一个提交,然后意识到我需要更改提交消息。
所以在我的本地仓库中,我做了:
git commit --amend -m "New commit message"
Run Code Online (Sandbox Code Playgroud)
但是当我尝试推送这个时,我收到了大量错误消息说
Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') and try again
Run Code Online (Sandbox Code Playgroud)
这是修改我的信息的错误方式吗?最后,我不得不重置我所有的 repos,然后用一条新消息再次提交。
所以我的问题是,修改已推送内容的提交消息的正确方法是什么?
我试图推送到远程仓库,但继续得到下面的错误.
$ git push
To user@remote.net:/home/user/repos/remoterepo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'user@remote:/home/user/repos/remoterepo.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
git remote show origin节目master pushes to master (local out of date).我很肯定它不应该过时,因为我只从分支机构推出.
我有两个问题.
是否可以强制本地分支覆盖遥控器?拉取将覆盖更改,这些更改肯定会晚于存储库中的内容.
这是我第二次或第三次遇到这个问题.我唯一能想到的是git的本地版本git version 1.7.3.1.msysgit.0(在Windows上)和远程版本是git version 1.6.5(Ubuntu Jaunty).是否有可能不同的git版本可能导致一些损坏?