简体   繁体   English

Git分支/标签/版本基础

[英]Git branching/tag/version basics

I guess I still don't get git as I'd hoped... 我想我还是不如我所愿...

I was creating a new branch, then going back, and I'm back farther than I intended. 我正在创建一个新分支,然后返回,但返回的距离比预期的要远。 So I need to come forward to where I was Monday or so. 所以我需要站起来回到星期一左右的地方。

If I use the Git Gui "Visualize all branch history" tool, I can see all my versions, and I think where I want to be. 如果我使用Git Gui“可视化所有分支历史记录”工具,则可以看到我的所有版本,并且我认为自己想去的地方。 So first question: how do I show that here? 所以第一个问题:我如何在这里显示? Git可视化截图

Then I'll just need to know the proper way to move forward to Monday's commit. 然后,我只需要知道前进到星期一提交的正确方法即可。

Thanks, 谢谢,

ed ED

The answer to this was to use Git Gui only very carefully. 答案是非常小心地使用Git Gui。 And to got to git log in the command line to really see what is happening. 并进入git登录命令行以真正查看正在发生的事情。

The commits I wanted ended up being left only in an unexpected branch, and it took a number of selective merges to get them back. 我想要的提交最终只保留在意外的分支中,并且进行了多次选择性合并以使它们返回。

Moral of the story: 故事的道德启示:

1) Make sure everything is committed somewhere. 1)确保一切都在某个地方完成。 You can always delete it from the repo, but not recover it if Git (with your help) drops uncommitted working directory files. 您始终可以从存储库中删除它,但是如果Git(在您的帮助下)删除了未提交的工作目录文件,则无法恢复它。

2) TortoiseGit and GitGui are nice tools. 2)TortoiseGit和GitGui是不错的工具。 But make sure you learned the basics in the command line before you do a git reset -hard 但是请确保在执行git reset -hard之前已在命令行中学习了基础知识

:-) :-)

If I understand this correctly, you created a branch of master but from a past point. 如果我正确理解这一点,那么您是从过去开始创建master分支的。 (please correct me if this is not what you mean). (如果这不是您的意思,请纠正我)。 Then all you have to do is merge the extra commits that were done after , to do that: 然后,您所需要做的就是合并在之后执行的额外提交,以实现以下目的:

git checkout <yourbranch>
git merge master

or 


git merge <commit>

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

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