Skip to content

longpham28/Git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Git Cheat Sheet

Config

  1. Set name:

    git config --global user.name "Your Name"
  2. Set email:

    git config --global user.email "youremail@example.com"
  3. Set user name

    git config --global user.username username

Create Repository

  1. Init:

    git init
  2. Status:

    git status
  3. Add:

    git add file.txt
  4. Commit:

    git commit -m "Committed"
  5. Different:

    git diff

Remote Control

  1. Add remote connections

    git remote add <REMOTENAME> <URL>
  2. Set a URL to a remote

    git remote set-url <REMOTENAME> <URL>
  3. Pull in changes

    git pull <REMOTENAME <BRANCHNAME>
  4. View remote addresses

    git remote -v
  5. Push changes

    git push <REMOTENAME> <BRANCH>

Forks And Clones

  1. Fork

    • Click Fork button
  2. Clone

    • Clone a respository

      git clone <FORKEDURL>
    • Connect to the Original Repository

      git remote add upstream <ORIGINALURL>

Branches

  1. GitHub Pages

    • GitHub will automatically serve and host static website files in branches named 'gh-pages'
  2. Create a branch

    git branch <BRANCHNAME>
  3. Go into a branch

    git checkout <BRANCHNAME>
  4. Create and Go into a branch

    git checkout -b <BRANCHNAME>
  5. List the branches

    git branch
  6. Rename a branch currently on

    git branch -m <NEWNAME>
  7. Merge data

    git merge <BRANCHNAME>
  8. Delete local branch

    git branch -d <BRANCHNAME>
  9. Delete a remote branch

    git push <REMOTENAME> --delete <BRANCHNAME>
  10. Pull from a remote branch

    git pull <REMOTENAME> <BRANCHNAME>

About

GIt Tutorial

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published