Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. Getting & Creating Projects
  2. Command Description
  3. git init Initialize a local Git repository
  4. git clone ssh://git@github.com/[username]/[repository-name].git Create a local copy of a remote repository
  5. Basic Snapshotting
  6. Command Description
  7. git status Check status
  8. git add [file-name.txt] Add a file to the staging area
  9. git add -A Add all new and changed files to the staging area
  10. git commit -m "[commit message]" Commit changes
  11. git rm -r [file-name.txt] Remove a file (or folder)
  12. Branching & Merging
  13. Command Description
  14. git branch List branches (the asterisk denotes the current branch)
  15. git branch -a List all branches (local and remote)
  16. git branch [branch name] Create a new branch
  17. git branch -d [branch name] Delete a branch
  18. git push origin --delete [branch name] Delete a remote branch
  19. git checkout -b [branch name] Create a new branch and switch to it
  20. git checkout -b [branch name] origin/[branch name] Clone a remote branch and switch to it
  21. git branch -m [old branch name] [new branch name] Rename a local branch
  22. git checkout [branch name] Switch to a branch
  23. git checkout - Switch to the branch last checked out
  24. git checkout -- [file-name.txt] Discard changes to a file
  25. git merge [branch name] Merge a branch into the active branch
  26. git merge [source branch] [target branch] Merge a branch into a target branch
  27. git stash Stash changes in a dirty working directory
  28. git stash clear Remove all stashed entries
  29. Sharing & Updating Projects
  30. Command Description
  31. git push origin [branch name] Push a branch to your remote repository
  32. git push -u origin [branch name] Push changes to remote repository (and remember the branch)
  33. git push Push changes to remote repository (remembered branch)
  34. git push origin --delete [branch name] Delete a remote branch
  35. git pull Update local repository to the newest commit
  36. git pull origin [branch name] Pull changes from remote repository
  37. git remote add origin ssh://git@github.com/[username]/[repository-name].git Add a remote repository
  38. git remote set-url origin ssh://git@github.com/[username]/[repository-name].git Set a repository's origin branch to SSH
  39. Inspection & Comparison
  40. Command Description
  41. git log View changes
  42. git log --summary View changes (detailed)
  43. git diff [source branch] [target branch] Preview changes before merging
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement