GIT - GloryDaysApp/glorydays GitHub Wiki

Cheatsheet

Git:

  • Create new branch:
    • [PROJECT] git checkout -b branch_name
  • Switch to branch:
    • [PROJECT] git checkout branch_name
  • Delete branch:
    • [PROJECT] git branch -d branch_name
  • Update from remote repository:
    • [PROJECT] git pull origin branch_name
  • Merge branch into active branch:
    • [PROJECT] git merge branch_name
  • Check status:
    • [PROJECT] git status
  • Unstage all changes that have been added to staging area:
    • [PROJECT] git reset .
  • Undo most recent commit:
    • [PROJECT] git reset HEAD~1
  • Fetch:
    • [PROJECT] git fetch
  • Commit:
    • [PROJECT] git status
    • [PROJECT] git diff file_name
    • [PROJECT] git add file_name
    • [PROJECT] git status
    • [PROJECT] git commit -m “#nr - name: message”
    • [PROJECT] git status
    • [PROJECT] git push origin branch_name
    • Click on generated link to create merge request (MR)
  • Fetch:
    • [PROJECT] git fetch
  • Change git user:
    • Local: (make sure you’re in local project directory)
      • git config user.name “githubUsername”
      • git config user.email email
    • Global:
      • git config --global user.name “githubUsername”
      • git config --global user.email email
    • See changes:
      • [LOCAL] git config --edit
      • [GLOBAL] git config --global --edit (edited)