Git Staged - 它有文件历史记录? [英] Git Staged - It have file history?

查看:142
本文介绍了Git Staged - 它有文件历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Git的新手。我真的恨使用命令行,所以我使用SmartGit。



我有一些关于git阶段的新手问题。




  • 正确的工作流程是: stage - >提交 - >同步。用本地提交,我有文件的历史。但是,在舞台上,我没有它?像这种情况下使用:

    • 我提出了一个修复程序。然后长时间工作,并保存在另一个阶段的过程。但我想回到第一阶段。我可以做这个?或者我失去了这段历史?


  • Staged就像一个ROM(只读存储器),所以我可以重写所有文件和旧文件失去了什么?

  • 为什么Stage是件好事?我所拥有的Commit没有什么?


解决方案

舞台区域存在是为了让你可以准备你的提交。例如,如果您对两个不同文件或同一文件的不同部分进行了无关的更改,则可以只分阶段执行其中的一个,然后执行另一个阶段并提交该文件(使用不同的提交消息)。



关于您的具体问题:

因为stage只是为了准备提交,所以它本身不是版本化的。所以,是的,一旦你演出另一个版本,旧版本就会丢失(它在技术上可能仍然作为存储库中的一个对象存在,但它并不容易实现)。



注意:暂存区域也在合并期间使用,因此准备提交不是只有使用。但是从用户的角度来看它是主要的。


I am newbie in Git. And I really HATE use the command line, so I am using SmartGit.

I have some newbie question about the stage of git.

  • The correct work-flow is : stage -> commit -> synchronize. With local commit I have the history of the file. But, with stage, I didn't have it? Like this case use:
    • I staged a fix. Then a work for a long time and save this in another staged process. But I want to go back to first staged. I can do this? Or I lost this history?
  • Staged is just like a ROM (read only memory), so I can rewrite all file and the olds are lost?
  • Why Stage is good thing to do? What I have in it that Commit don't have?

解决方案

The reason the stage area exists is so that you can prepare your commit. For example, if you made unrelated changes to two different files, or different parts of the same file, you can stage only one of them, commit, then stage the other one and commit that (with different commit message).

Regarding your specific questions:

Because stage is there just for preparing your commit, it's not versioned itself. So, yeah, once you stage another version, the old one is lost (it might technically still exist as an object in the repository, but it's not easy to get to it).

And it's nothing like ROM, since you can write to it.

Note: The staging area is also used during a merge, so preparing your commit is not the only use. But it's the main one from the user's point of view.

这篇关于Git Staged - 它有文件历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆