Skip to content

Instantly share code, notes, and snippets.

@saledwin
Last active April 25, 2018 14:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saledwin/82eb234938a8e4ba829eef0e15e28f0d to your computer and use it in GitHub Desktop.
Save saledwin/82eb234938a8e4ba829eef0e15e28f0d to your computer and use it in GitHub Desktop.
Util git commands

Util Git commands

  • Show changes git status
  • Commit changes with message git commit -m "Commit message"
  • Show actual branch git branch
  • Add files to stash git add --A
  • Discard changes git checkout -- .

Branches

  • Switched to a branch git checkout branch_name 
  • Create a new branch git cheackout -b new_branch_name
  • Delete a branch git branch -d branch_name

Merge

  • Commit all your changes.
  • Switch to branch target running git checkout branch_target
  • Merge the changes git merge branch_source
  • Update remote git push origin branch_target

Remote

  • Add remote git remote add origin url_remote
  • Push changes to remote repo git push origin branch_name
  • Update (Pull) the local branch git pull branch_name
  • Delete a branch from remote git push remote_name --delete branch_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment