Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. This gist adds aliases for the most used git commands.
  2.  
  3. Open the .gitconfig file and append the below code to existing alias section.
  4.  
  5. st = status
  6. ci = commit
  7. ad = add -A
  8. last = log -1 HEAD
  9. com = checkout master
  10. plm = pull origin master
  11. psm = push origin master
  12. co = "!f() { git checkout $1; }; f "
  13. pl = "!f() { git pull origin $1; }; f "
  14. ps = "!f() { git push origin $1; }; f "
  15. br = branch
  16.  
  17. If there is no alias section, add below code to .gitconfig.
  18.  
  19. [alias]
  20.  
  21. st = status
  22. ci = commit
  23. ad = add -A
  24. last = log -1 HEAD
  25. com = checkout master
  26. plm = pull origin master
  27. psm = push origin master
  28. co = "!f() { git checkout $1; }; f "
  29. pl = "!f() { git pull origin $1; }; f "
  30. ps = "!f() { git push origin $1; }; f "
  31. br = branch
  32.  
  33. Examples:
  34.  
  35. git st
  36. git ci
  37. git ad // Stages all unstaged files
  38. git last // last commit
  39. git com // checks out master
  40. git plm // pulls master branch from origin
  41. git psm // pushes master branch to origin
  42. git co <branch_name> // checks out branch_name
  43. git pl <branch_name> // pulls branch with branch_name from origin
  44. git ps <branch_name> // pushes branch with branch_name to origin
  45. git br
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement