Guest User

Git Commands

a guest
Dec 15th, 2016
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. Basic Git commands.
  2.  
  3. git clone <url> - get the repository
  4. git commit -a -m "Commit message here." - Commit all changes to current branch
  5. git checkout <existing_branch_name> - switch to branch
  6. git checkout -b <new_branch_name> - create a new branch and switch to it
  7. git reset --hard - destroy ALL local changes made to current branch
  8. git cherry-pick <commitid> - patch in JUST the changes made in the commitid provided
  9. git fetch <url> - download repository from online, but keep it in a cache (useful for cherry-picking commits in forks you don't have)
  10.  
  11. Git Push / Pull.
  12.  
  13. git push - push all changes to the current remote+branch
  14. git push -u origin master - push all changes to remote "origin" branch "master" and set push to push there by default
  15. git pull - pull all changes from the current remote+branch and merge them with the current local branch
  16.  
  17. Git creation.
  18.  
  19. git init - create a git repository in the current directory
  20. git remote add origin <url> - set the remote "origin" to the url. This is usually provided by Github or similar.
Advertisement
Add Comment
Please, Sign In to add comment