GitHub Cheatsheet

Ever have trouble recalling the exact syntax for your favorite HTML code? Give it a permanent home and add it to this page! Select any snippet below and it'll automatically select all of the code for you to copy.

Git Configuration

This is used to configure initial get hub account and start up.


git version
git config --global user.name "Abe Lincoln"
git config --global user.email "mrabe@git.training" 
git config --global --list
    

Setting up a Project Folder

Command listing


            pwd
            mkdir project-name
            cd project-name
            pwd
            

Git Clone

Copy the Repository (clone)


        
    git clone (paste in your GitHub HTTPS clone URL)
    ls
    cd to the new file
    ls
    git status
            

Git Touch

Touch is the get command to create a new page within a folder


        
    git touch index.html
    
            

Git Commit

You must add then commit and remember to comment before pushing The files to get Github


    git status
    git add start.txt   or
    git add -A      (all files)
    git status
    git commit -m "Adding text to file" 
    git status
            

Git Push

I'll remember to pull before pushing to identify any merge conflicts


        git push
            

Git Checkout

Git check out –b will allow you to create a new branch
Git branch will show you what branch you are currently on
Get check out <branch name> will switch the branch you are on



    git checkout -b <branch-name>
    git branch
    git checkout main or master
    git branch
            

Git Merge

This will merge the branch that you select with the branch that you were currently on



    git merge <branch-name>
            

Merge Main with Working Branch

The steps to update your main branch and then take those updates and put them in your work in branch. Click here for the full Cheat Sheet



    git checkout main
    git pull
    git checkout <branch-name>
    git merge main
    git add -A
    git commit -m "merge complete"
            

Git Pull Origin Main



    git pull origin main
    

Branch Delete

This will Delete a old branch you are no longer working within after merging into maine



    git branch -d <branch-name>
            

Git Stash



    git stash