目前,我正在研究'external_pub'分支.我在一个文件中做了一些更改,添加了它,提交然后尝试推送:
git push origin external_pub
Run Code Online (Sandbox Code Playgroud)
但这导致了一个错误:
remote: error: hook declined to update refs/heads/external_pub
To ssh://XXX/testing.git
! [remote rejected] external_pub -> external_pub (hook declined)
error: failed to push some refs to 'ssh://XXX/testing.git'
Run Code Online (Sandbox Code Playgroud)
然后我尝试推送分支而不做任何改变,看看会发生什么(仅用于隔离问题).我做了以下事情:
git reset --hard <commit_id> (to reset to last working sha commit)
git status
Run Code Online (Sandbox Code Playgroud)
以上命令显示:
# On branch external_pub
# Your branch is ahead of 'development' by 5 commits.
#
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)
然后
git pull origin external_pub
Run Code Online (Sandbox Code Playgroud)
它显示:您的分支已经是最新的
然后
git push origin external_pub
Run Code Online (Sandbox Code Playgroud)
这次也显示出与上述相同的错误.你能帮我解决这个问题吗?
我以为我理解git pull -rebase是如何工作的,但是这个例子让我感到困惑.我猜想以下两种情况会产生相同的结果,但它们不同.
首先,有效的.
# Dan and Brian start out at the same spot:
dan$ git rev-parse HEAD
067ab5e29670208e654c7cb00abf3de40ddcc556
brian$ git rev-parse HEAD
067ab5e29670208e654c7cb00abf3de40ddcc556
# Separately, each makes a commit (different files, no conflict)
dan$ echo 'bagels' >> favorite_foods.txt
dan$ git commit -am "Add bagels to favorite_foods.txt"
brian$ echo 'root beer' >> favorite_beverages.txt
brian$ git commit -am "I love root beer"
# Brian pushes first, then Dan runs `git pull --rebase`
brian$ git push
dan$ git pull --rebase
dan$ git …Run Code Online (Sandbox Code Playgroud) 我怎样才能清除存储库并推送新的存储库来代替它。
我的项目大小超过 2GB,我检查了.git文件夹,它的大小是 1.5GB,我尝试删除.git文件夹,然后git init强制推送项目,但远程存储库大小没有改变,我的步骤:
git init
git add .
git commit -m "First Push"
git remote add origin http://Url_here
git push -f origin master
Run Code Online (Sandbox Code Playgroud)
如何替换存储库内容?
对不起,这可能是一个愚蠢的问题,但我无法弄清楚问题.
我通过git(bitbucket)克隆了一个分支,更改了一些文件,提交了这些文件并将它们推回到远程源.
现在我想将此提交推送到另一个分支,该分支部分位于当前分支的前面和后面.所以我尝试过:git push origin HEAD:differentBranch但是这没有用("更新被拒绝了,因为推送的分支提示在其远程对手后面").
我怎样才能解决这个问题?再次抱歉,我的git技能仍然可以开发.
我已经更改了我的git存储库中某些目录的大小写.然后我推了他们,注意到没有更新的情况.
然后我发现了这个问题: git mv并且只改变了目录的大小写
我按照建议使用:
git add -A
git commit --amend -m 'updated cases'
git push origin
Run Code Online (Sandbox Code Playgroud)
但git服务器返回成功而不是成功:
To git@github.com:kyogron/example.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:kyogron/example.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仓库中破坏更多?
问候,
博多
PS:为了避免将来出现这个问题,您可以使用:
git config core.ignorecase false
Run Code Online (Sandbox Code Playgroud) 我一直在做一个项目,事情变得草率.我要做reset一个稳定的提交,但是当我试着push告诉"当前的分支是在它的远程对手后面"(显然).Git让我执行的唯一选择是git pull.当我尝试的时候,我又回到了新的,草率的提交,这些提交不起作用,我不想要.
我做了一个不同的分支调用stable并运行reset --hard到稳定提交,然后尝试以下方法:
$ git checkout stable
# => Switched to branch 'stable'
$ git merge -s ours master
# => Already up-to-date.
$ git checkout master
# => Switched to branch 'master'
# => Your branch is behind 'origin/master' by 9 commits, and can be fast-forwarded (use "git pull" to update your local branch)
$ git merge stable
# => Already up-to-date.
Run Code Online (Sandbox Code Playgroud)
运行这些命令后,我的master分支仍然处于我想要摆脱的状态.
我想stable成为新人, …
我在尝试在 GIT 上推送项目时遇到以下问题。
推送它我收到此错误消息:
$ git push origin master
To https://bitbucket.org/MyAccount/my-project.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://MyAccount@bitbucket.org/MyAccount/my-projec.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git …Run Code Online (Sandbox Code Playgroud) 我去推动工作到我的主分支,但我得到这个错误:
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/Machinas/esprit-rwd'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushin
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
我不想获取另一个人提交的更新,因为这是他们的错误,我怎么能推动并忽略该提交?谢谢
我是TFS和GIT的菜鸟,并将现有的Lightswitch项目迁移到TFS.我在TFS中启动了一个带有GIT仓库的新项目并加载了我的项目,但在重命名父目录后,几乎立即在主文件上损坏了一些东西.我试图恢复到我最初加载的提交(我可以下载zip并确认它按预期工作),但最终只是添加了一些其他提交更改,这些更改没有让我回到原始状态.
作为序言,当我克隆到Visual Studio时,我相信它会拉动最新的sln,除非我从拉链拉出来.但是使用zip,我无法推送提交(或者至少我认为).我现在意识到>:PI是一个白痴,应该立即开始分支,但长话短说,TFS的第一次加载没有拉入sln因为我从我的本地git拉到远程服务器,所以我不得不创建基于加载的git历史记录的新解决方案.所有这些都在升级VS 2013 >> 2015以匹配2015 TFS服务器之后.
我尝试了'git revert bf4d79..26aa08'和'git log'中的长ID,但它在星期一刚刚添加了前两个.我觉得我走向了错误的方向,我担心我会杀了我的多月项目.最糟糕的情况我从TFS删除项目并从头开始.
顺便说一句,我是这方面唯一的开发人员,拥有它的所有管理员权限.如果你没有猜到,我从业务方面自学,但现在已经发展了几年.
显然非常感谢任何帮助,我在这一切中学到了一些宝贵的经验教训.谢谢!
这是我遇到困难的更好的图片.
**************回答******************
谢谢TerjeSandstrøm!工作就像一个魅力.
git reset --hard 4358ca58
git push -f origin master
Run Code Online (Sandbox Code Playgroud)
另外,弄清楚为什么从git到TFS的初始传输没有携带sln文件.sln被保存在git tracked文件夹之外.
从错误中吸取教训可能很困难,但它肯定会阻止你重复它.