Skip to content

Latest commit

 

History

History
92 lines (73 loc) · 1.58 KB

README_GIT_COMMANDS.md

File metadata and controls

92 lines (73 loc) · 1.58 KB

Git commands used

Here is a list of commands used to populate window data or execute some git operations

  • Get current branch

    git symbolic-ref --short HEAD
  • Get all branches

    git branch -a --no-color
  • Get ref paths

    git for-each-ref --sort -committerdate --format "%(refname) %(objectname) %(*objectname)"
  • Revert file (untracked)

    git clean -f -q -- "PATH"
  • Revert file (tracked)

    git checkout "PATH"
  • Diff file

    git diff --cached --word-diff=porcelain -U9999 FILE_PATH
  • Get commits

    git log --format="%H #UG# %h #UG# %an #UG# %ae #UG# %ai #UG# %s" --max-count=301 --date-order master --
  • Stage files

    git add -A -- FILE_OR_FILES_PATH
  • Commit staged files

    git commit -m MESSAGE_TEXT
  • Push commits

    git push
    git push -u ORIGIN_NAME BRANCH_NAME
  • Checkout to branch

    git checkout  BRANCH_NAME
  • Check if branch exist

    git rev-parse --verify BRANCH_NAME
  • Create branch

    git checkout -b BRANCH_NAME FROM_BRANCH_NAME
    git branch BRANCH_NAME FROM_BRANCH_NAME
  • Get commits behind

    git status -b --porcelain=v2
    git branch BRANCH_NAME FROM_BRANCH_NAME
  • List changes

    git status -u -s
    
  • Set path for private ssh path

    git config core.sshCommand "ssh -i PRIVATE_SSH_KEY_PATH"