学习Git。需要知道我是否在正确的轨道上 [英] Learning Git. Need to know if I am on the right track

查看:102
本文介绍了学习Git。需要知道我是否在正确的轨道上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我开始使用Git作为SCM之前,我会彻底测试代码的稳定性,然后我只需复制工作目录并将其重命名为(date)project_name。然后,如果我搞砸了某个地方,不能挖掘自己,我会从最后一个稳定的目录开始。然后我听说Git。



我想知道我是否正确使用Git。这是我一直在做的:


  1. 编写一些代码...


  2. git add。将所有已更改的文件添加到舞台上


  3. git status 来检查这些已更改的文件是否已准备好提交


  4. git commit 提交最新的更改并编写提交消息


  5. 重复


到目前为止,这是我一直在做的。为了简单的备份目的以及恢复到以前的稳定性的能力,这是否足够了解Git?如果不是,我还应该知道些什么? 解决方案

如果您想要做的就是能够重置为旧提交出了问题,那么是的,就是这样。虽然您可以将所有git步骤合并为一个:

  git commit -a 

(提交所有更改的跟踪文件)




如果你有时间,我会考虑分支和标记,但他们并不是严格要求你做的事情,他们只是倾向于让生活更轻松


Before I started using Git as my SCM, I would "throughly" test the code for stability then I'd just copy the working directory and rename it to something like (date)project_name. Then if I messed up somewhere and couldn't dig myself out I would just start from the last stable directory. Then I heard about Git.

I want to know if I'm using Git correctly so far. This is what I've been doing:

  1. write some code...

  2. git add . to add all the changed files to the stage

  3. git status to check if those changed files are ready to be committed

  4. git commit to commit the latest changes and write a commit message

  5. repeat

So far this is all I've been doing. For simple backup purposes and for the ability to revert back to a "previous stability" is this enough knowledge of Git? If not, what else should I know?

解决方案

If all you want to do is be able to reset to an old commit when something goes wrong, then yes, that's it. Although you can combine all the git steps into one with:

git commit -a

(which commits all changed tracked files)


I would look into branching and tagging if you have time, but they're not strictly required for what you're doing, they just tend to make life easier

这篇关于学习Git。需要知道我是否在正确的轨道上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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