Skip to content

Instantly share code, notes, and snippets.

@VeeAndrade
Last active July 29, 2019 13:25
Show Gist options
  • Save VeeAndrade/d099b2775f1fdf2dea5c128bdb5544a3 to your computer and use it in GitHub Desktop.
Save VeeAndrade/d099b2775f1fdf2dea5c128bdb5544a3 to your computer and use it in GitHub Desktop.

Beginners Guide To Git


Things We Will Go Over

  • Git add
  • Git status
  • Git diff
  • Git commit
  • Git push
  • Git pull
  • Github

What is git?

Using a reddit post under subcatagory: Explain like I'm five

5 year old explanation:

You and Billy decide to draw a picture together with crayons, but you both want to be able to work on it from home. The teacher makes 2 photocopies of what you have started and you both take a copy home (pulling/checking out). You both add more things to the drawing and when you come back to school tomorrow, the teacher cuts and pastes the bits you added / changed and then photocopies that (merging). If you both colored in the same area, someone has to choose which portion to use (resolving a conflict). And since there are photocopies every time something is changed, you can throw away all the new ones if you don't like what you've done (reverting).


*In shorter words git is a way to track your changes.


How Would You Start...?

  1. If you haven't already, you need to install Git and create a Github account.

  2. Create a local git repository (repo) To get started you'll open up your terminal and move to where you want to place your project by using the CD (Change Directory)command.

  3. To initialize a git repository in the folder, run Git Init command.

  4. Add a new file to the folder by using your text editor or running Touch command. Once you makes changes inside the folder, git will notice the changes but will not track them officially yet.

  5. Run Git Status command to see what git knows exist inside the new folder. This will show you the files that git is not tracking and changes that haven't been saved.

  6. Run Git Add command to tell git to start tracking this file. You can run git status again just to see that the command went through and is now tracking your modified file and has placed the file into the staging area and will say something like "Changes to be committed"

  7. This is where you'll create a commit by using "git commit -m" and write out a small message explaining the changes you made. ** DO NOT FORGET TO INCLUDE "-m"

  8. After you've finished all your commits, you can use your git push origin master command to push your commits to github.

  9. Now that you have that done, you can get pull origin master to have the most up to date version of the repo.


git diagram


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment