Your first commit – How to start using git

git is a version control system that allows you to keep track of all the changes you make to your code, writing and anything text. Instead of saving the current state of your files, git saves the changes you make to files.

Imagine you create a file called “my_file.txt” and later this to your git history.

This change will look like this.

`— /dev/null` means this was created out of nowhere (a new file)

`+++ b/my_file.txt` is the name of your new file

 

Platforms to host git projects:

Github, Bitbucket, GitLab

Step by step

  1. Create an account
  2. Create a repository
  3. Create a new git repo on your local machine
    1. git status – to check your status
  4. Direct your local repo to track a git url (your new repo)
  5. Commit your changes
    1. git add <file_name>- to add the files
    2. git commit – to track a change
    3. Add your commit message (“yay first commit”)
  6. Push

 

Git has a ton of gotchas that can trip up a beginner:

Check out common git gotchas