了解Git和GitHub的基础知识 [英] Understanding the basics of Git and GitHub

查看:82
本文介绍了了解Git和GitHub的基础知识的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不完全理解使用Git或Github的目的;我知道这有助于跟踪您的变化,这对与其他人合作的人有帮助,但我不与任何人合作,所以我不知道这对我有帮助。



我通常是作为网页设计师/开发人员工作,但我从不需要协作。我知道在Git中,您已经为每个存储库创建,推送,提交,创建分支等,但是...


  1. 什么是Git和GitHub之间的区别是什么?


  2. git是否在本地(在用户的机器中)和GitHub中保存每个存储库? $ b

  3. 你可以在没有GitHub的情况下使用Git吗?如果是的话,使用GitHub有什么好处?

  4. >
  5. 这是一个手动过程,换句话说,如果您没有提交,您将无法获得所做更改的新版本?


  6. 如果不合作,而且您已经在使用备份系统,那么您为什么要使用Git?

  7. >解决方案



  1. Git和GitHub有什么不同?


    Git是一个版本控制系统;将其视为您的代码的一系列快照(提交)。您会看到这些快照的路径,它们按照何种顺序创建。您可以让分支进行实验并回到您拍摄的快照。



    GitHub是一个网页,您可以在其中发布Git存储库并与其他人协作。

    是否Git在本地(在用户的计算机中)和GitHub中保存每个存储库?


    不,它只是本地的。您可以决定在GitHub上推送(发布)一些分支。


  2. 你可以在没有GitHub的情况下使用Git吗?如果是,使用GitHub有什么好处?


    是的,如果您不使用GitHub,Git将运行本地。使用GitHub的替代方案可以在托管在Dropbox上的文件上运行Git,但是GitHub是一种更加简化的服务,因为它专门用于Git。

  3. $ b

    Git与Time Machine等备份系统相比如何?

    这是一个不同的事情,Git让你跟踪变化和你的发展过程。如果您将Git与GitHub一起使用,它将成为备份。但是,通常情况下,您不会一直推送到GitHub,在这种情况下,如果出现问题,则无法进行完整备份。
    我在一个与Dropbox同步的文件夹中使用git。


  4. 这是一个手动过程,换句话说如果您没有提交,您将不会有新版本的更改?


    是,提交和推送都是手动。


  5. 如果不合作,并且您已经在使用备份系统,那么您为什么要使用Git?





    • 如果您在提交之间遇到错误,可以使用命令 git diff 来查看当前代码和上次工作提交之间的区别,帮助您找到错误。

    • 您也可以回到最后一次工作提交。 如果您想尝试更改,但不确定它会起作用。你创建一个分支来测试你的代码更改。如果工作正常,则将其合并到主分支。如果不是这样,你只需将分支放回主分支。 你做了一些调试。在提交之前,您始终查看上次提交的更改。您看到您忘记删除的调试打印语句。



  6. 确保您检查 gitimmersion.com


    I don't fully understand the purpose of using Git or Github; I know it helps to keep track of your changes and it's helpful for people collaborating with other people, but I don't collaborate with anybody so I don't know if this would be helpful for me.

    I usually work as a web designer/developer but I never have to collaborate. I know in Git you have create, push, commit, create branches etc for every repository but...

    1. What is the difference between Git and GitHub?

    2. Is git saving every repository locally (in the user's machine) and in GitHub?

    3. Can you use Git without GitHub? If yes, what would be the benefit for using GitHub?

    4. How does Git compare to a backup system such as Time Machine?

    5. Is this a manual process, in other words if you don't commit you wont have a new version of the changes made?

    6. If are not collaborating and you are already using a backup system why would you use Git?

    解决方案

    1. What is the difference between Git and GitHub?

      Git is a version control system; think of it as a series of snapshots (commits) of your code. You see a path of these snapshots, in which order they where created. You can make branches to experiment and come back to snapshots you took.

      GitHub, is a web-page on which you can publish your Git repositories and collaborate with other people.

    2. Is Git saving every repository locally (in the user's machine) and in GitHub?

      No, it's only local. You can decide to push (publish) some branches on GitHub.

    3. Can you use Git without GitHub? If yes, what would be the benefit for using GitHub?

      Yes, Git runs local if you don't use GitHub. An alternative to using GitHub could be running Git on files hosted on Dropbox, but GitHub is a more streamlined service as it was made especially for Git.

    4. How does Git compare to a backup system such as Time Machine?

      It's a different thing, Git lets you track changes and your development process. If you use Git with GitHub, it becomes effectively a backup. However usually you would not push all the time to GitHub, at which point you do not have a full backup if things go wrong. I use git in a folder that is synchronized with Dropbox.

    5. Is this a manual process, in other words if you don't commit you won't have a new version of the changes made?

      Yes, committing and pushing are both manual.

    6. If are not collaborating and you are already using a backup system why would you use Git?

      • If you encounter an error between commits you can use the command git diff to see the differences between the current code and the last working commit, helping you to locate your error.

      • You can also just go back to the last working commit.

      • If you want to try a change, but are not sure that it will work. You create a branch to test you code change. If it works fine, you merge it to the main branch. If it does not you just throw the branch away and go back to the main branch.

      • You did some debugging. Before you commit you always look at the changes from the last commit. You see your debug print statement that you forgot to delete.

    Make sure you check gitimmersion.com.

    这篇关于了解Git和GitHub的基础知识的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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