Git Cheat Sheet

 

Git: Configuration - Basic Git Commands

$ git config --global user.name "First Name Last Name"

Run this command to set your Git username. You should specify your first name and last name both, your username can be anything you want to attach to your commits.

$ git config --global user.email "Your Email Address"

Run this command to set your email address.

$ git config --global color.ui true

Run this command to turn on all Git's colored terminal output, The default setting is auto.

$ git config --list

shows all Git config properties throughout all of the variously scoped Git files.

Git: Starting a repository

    $ git init

    $ git status

Git: Staging files

    $ git add <filename>

    $ git add <filename> <another filename>

    $ git add .

    $ git add --all

    $ git add -A

    $ git rm --cached <filename>

    $ git reset <filename>

Git: Committing to a repository

    $ git commit -m "Add files"
    $ git reset --soft HEAD^
    $ git Commit --amend -m <Your Message>

Git: Pushing and pulling from and to repositories

    $ git remote add origin <link>
    $ git push -u origin master
    $ git clone <clone>
    $ git pull

Git: Branching

    $ git branch
    $ git branch <Branch name>
    $ git checkout <Branch name>
    $ git merge <Branch name>
    $ git checkout -b <Branch name>


Post a Comment

0 Comments