GitHub Illustrated
The basics
You can think of there being two copies of the repository, one local (on your computer) and the other remote (in the cloud). The local environment has three pieces, your working directory, a staging area and your local repository. You won't see anything except your working directory, which might include files being tracked in the repository as well as other files that you haven't brought into the repository. You can ask git to tell you what files that you have committed to the repository have changed and what files in the directory aren't part of the repository.Â
Once you have made changes to a file and want to commit these changes, you'll first "stage" the commits. The line command for this is git add <filename>, but github desktop allows you to click on a box to identify files you want to add to a commit and then you add a comment and add and commit by clicking on "Commit to master". If you make changes to a file that you don't want to keep, you can right click on the file name and select "discard changes." That will pull the old version of the file from the (invisible to you) local repository into your working directory. The command-line equivalent of discarding changes is git checkout.Â
After you have committed your changes to the local repository, you still need to push those changes to github for them to be in the remote repository.
If you are keeping a GitHub repository for solo work and accessing the local repository with only one local computer, that might be all you ever need to know. But if you are using the repository to manage files on two computers (e.g. a work desktop and a home desktop) or if you are collaborating, you'll likely need to know a few more commands. Specifically, if two local computers have different versions of the same file, you'll need to learn how to merge.Â
Merging
The figure below adds merging and a few other utilities to the basic diagram
(note that you can click on the diagrams to see their sources)
Welcome to the University Wiki Service! Please use your IID (yourEID@eid.utexas.edu) when prompted for your email address during login or click here to enter your EID. If you are experiencing any issues loading content on pages, please try these steps to clear your browser cache.