Giter VIP home page Giter VIP logo

gitstuffdone's Introduction

GitStuffDone

Simple git reference for when I forget.

๐ŸŽ‰ Creating Repositories

  • git init - create a new repo
  • git clone <repo url> <folder name> - download a project to a custom folder
  • git status - check repo status

๐Ÿ“… Repo History

  • git log - display commit ID (SHA), author, date, and commit message
  • j(up), k(down), q(exit) - scrolling through commit history
  • git log --stat - view modified files
  • git log -p or git diff - view file changes in commit
  • git log -p --stat - view both modified files and file chanegs
  • git show <SHA id> - view file changes of specific SHA id
  • git show SHAid --state - view modified files of specific SHA
  • git log --stat <SHA id> - view specific commit by ID

โž• Adding

  • git add . - add all files in current directory to stage
  • git add <file names with space as delimiter> - add specific files to stage
  • git add -u - add all tracked files

๐Ÿ“Œ Committing

  • git commit -m <message> - write a commit message without using the text editor
  • git commit - write commit message with text editor opened
  • git commit -a - directly add files to the repo without going through staging

โœ‚๏ธ GitIgnore

  • Note: Assumes that VSCode is installed.
Linux / OSX / GitBash
  1. Run touch .gitignore to create a file
  2. Run code .gitignore to open and edit
Windows Powershell
  1. Run New-Item .gitignore -type file to create a file
  2. Run code .gitignore to open and edit
Windows CMD
  1. Run copy NUL .gitignore to create a file
  2. Run code .gitignore to open and edit

๐Ÿ  Tagging

  • git tag - check version of tag in command line
  • git tag -a <tag name> - write a message for a specific version of the file
  • git log --decorate - show the current branch and tag version
  • `git tag -d - delete tag version
  • git tag -a <tag name> <SHA id> - add a tag for a specific commit by SHA id.

๐ŸŒฟ Branching

  • git branch - show current branch
  • git branch <branch name> - create a new branch
  • git checkout <existing branch name> - switch to another branch
  • git log --oneline --decorate - display current active branch with SHA id and commits only
  • git branch -d <branch name> - delete branch by name
  • git checkout -b <branch name> - create new branch and switch to it
  • git checkout -b <branch name> master - create a new branch in the same location as the master branch and switch to it
  • git log --oneline --decorate --graph --all - display all branches in folder

๐Ÿ“ƒ Merging

  • git reset --hard HEAD^ - undo branch merge
  • git merge <branch name> - merge branch by name

โœ”๏ธ Correcting

  • git commit --amend - correct commit details in branch
  • git revert <SHA id> - revert changes up to commit specified by id

๐ŸŒŒ Remote

  • git remote add origin <repo url> - add a remote url for the repository
  • git remote set-url origin <repo url> - set a specific url for the repository
  • git remote -v - check the push and pull locations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.