繁体   English   中英

git“将本地更改签入索引但未提交”

[英]git “local changes checked into the index but not commited”

我在家用台式机上编辑了文件,然后推送到bitbucket.org并上传到我的测试网站。 然后,我从bitbucket.org拉到笔记本电脑。 它告诉我我需要合并文件,但我不知道如何合并,因此我将文件从测试网站复制到笔记本电脑的本地目录中并继续工作。 我认为我是mutt领导的整个合并过程,并使用gitg进行了更改(不确定是否提交)。

当我尝试从笔记本电脑推送到bitbucket.org时,我的问题和无知变得更加明显:

kurt@tosh ~/Public/laddercms $ git status

On branch NumPermit
Your branch is ahead of 'origin/NumPermit' by 2 commits.

nothing to commit (working directory clean)

kurt@tosh ~/Public/laddercms $ git push -u origin NumPermit 

Password
for 'https--kurtjensen@bitbucket.org':  To
https--kurtjensen@bitbucket.org/kurtjensen/laddercms.git  !

[rejected]        NumPermit -> NumPermit (non-fast-forward) error:
failed to push some refs to 'https--kurtjensen@bitbucket.org/kurtjensen/laddercms.git' 
hint: its remote counterpart. Merge the remote changes (e.g. 'git
pull') hint: before pushing again. hint: See the 'Note about
fast-forwards' in 'git push --help' for details.

kurt@tosh ~/Public/laddercms $ git pull origin NumPermit 

Password for
'https--kurtjensen@bitbucket.org':  From
https--bitbucket.org/kurtjensen/laddercms  * branch           

NumPermit  -> FETCH_HEAD Auto-merging profile/ajax/ProfileForm.php

CONFLICT (content): Merge conflict in profile/ajax/ProfileForm.php
Auto-merging Core/protect.php 

CONFLICT (content): Merge conflict in Core/protect.php Auto-merging 
Core/class.credentials.php 

CONFLICT (content): Merge conflict in Core/class.credentials.php 
Auto-merging Core/class.access.php 

CONFLICT (content): Merge conflict in Core/class.access.php Automatic
merge failed; fix conflicts and then commit the result.

我想保留我的本地便携式计算机文件(我最相信它们是正确的。)

现在在gitk中,我看到:

作者:提交人:父母:9d2cd77d4250bbf71e367021acf65e2c2465d0df(就我所知,即使使用NLIKey,New Protect.php仍可正常工作)子级:0000000000000000000000000000000000000000(本地未提交的更改,未签入索引)分支:

 Local changes checked in to index but not committed 

我如何将(台式机,笔记本电脑,bitbucket)上的世界还原到此“提交/签入”点?

提前致谢...

Quote:“展览是我的专长。”

一些信息,这将节省您下次的麻烦:

它告诉我我需要合并文件,但是我不知道如何合并,所以我将文件从测试网站复制到笔记本电脑的本地目录中并继续工作

当您从桌面推送到Bitbucket时,应该在笔记本电脑上完成以下操作:

git fetch origin
git checkout master
git merge origin/master

提取操作将检索远程分支上的所有最新更改,检出将您置于要合并到的任何本地分支中(在本例中为master),并且merge命令说将原始/ master中的任何内容合并到本地分支master中。 这是一个非常基本的工作流程,并且在同一个项目上工作2个ppl。

无论如何,为了在不保留历史记录的情况下进行快速而又肮脏的恢复,我只需删除.git文件夹,然后在根文件夹中运行git initgit remote add <alias> <url>git add . + git push alias master -f 为了更智能地进行恢复,您需要提供有关git状态的更多信息,并稍微整理一下帖子。

暂无
暂无

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

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