English 中文(简体)
3. 错误后发现过去的工作
原标题:Recovering past work with git after mistake
  • 时间:2012-04-24 11:10:40
  •  标签:
  • git
  • github

Let me preface this by saying that I am relatively new to git so I might have difficulty correctly expressing my situation.

I was doing some work on a project and I wanted to commit the changes I had made. I proceeded to run through the next few commands:

   git add .
   git commit -m "Finished user signup"

此时此刻,它似乎处理我的承诺,处理所有变化、插入和删除。 我接着说:

    git checkout master

It successfully switched to the master branch. I thought I had been in a branch at the time and I tried merging it, but that didn t work so I just moved forward. I pushed and everything was up to date. Then I made some quick changes to other files and tried:

    git commit -am "Add SSL in production"

它取得了成功。 然而,在我上次承诺之前所作的所有改动现在都已停止,我真的希望尽可能回头来。 我现在认识到,也许我需要退步,实际上要服从于《伊斯兰堡宣言》,而不是仅仅通过辅导一米之后的步骤,但我真的会热心尽可能在这个基础上找到一个ulli。 如果你有任何想法,我如何能够把我的档案整理回来,我可以真正利用你的帮助。

Edit: I tried looking at the log with "git log" and it doesn t show any sign of the commit I want to recover...

最佳回答

从我可以理解的角度来看,你从专题图书馆转向总务,但你确实把专题图书馆的承诺合并起来。 你们可以利用 g点指挥系统进行合并或重新调整:

# Be sure you re in the master branch, you should see a star before master
$git checkout master
$git branch
# Now take the commits from the topic-branch
$git rebase TOPIC_BRANCH_NAME

Using $git log you should be able now to see the other branch s commits.

问题回答

如果原因在进行改动时没有检查分行,则可能无法追踪那些失踪的人。 产出的第一栏列出了你可能发现你正在寻找的 commits。 在你发现某一具体承诺之后,如<代码>abc123,你可以做如下工作:<代码>git Branchrecovery abc123。

我认为,如果最后一项承诺是:

git reset HEAD^1

它将 o头部(公用)





相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签