Summary of Git Command

 Get all sources from remote git

  1. create workspace or project folder.
  2. use the "git init"command in the Project folder.
  3. git remote add origin https://....../xxx.git
  4. git pull origin master

When committing to a remote location 

  1. how to set global config in git
    - git config --global user.name "steve.lee"
    - git config --global user.email "steve.lee@example.com"
  2. git add [filename/ . ]
  3. git commit -m "message"
  4. push -u origin master

Summary of frequently used commands in Git 

  1. git init = create a git
  2. git clone git_path = acquiring code from somewhere
  3. git checkout branch_name = select a branch
  4. git checkout -t remote_path/branch_name = select a remote branch
  5. git branch branch_name = create a branch
  6. git branch -r = list of a remote branch
  7. git branch -a = list of a local branch 
  8. git branch -m branch_name change_branch_name = change a branch name
  9. git branch -d branch_name = delete branch 
  10. git push remote_name --delete branch_name = delete remote branch
    example: (git push origin --delete gh-pages)
  11. git add file_path = select code that edited
    example: (git add *)
  12. git commit -m "commit_description" = fill out description on code that selected
    example: (git commit -m "comment~~")
  13. git push remote_name branch_name = send the code that added and committed to git server
    example: (git push origin master)
  14. git pull = pull the newest code from git server and merge on the  workspace that you are staying
  15. git fetch = fetch the newest code from git server 
  16. git reset --hard HEAD^ = cancel previous code that committed
  17. git reset --soft HEAD^ = maintain code and cancel only commit
  18. git reset --merge = cancel the merge
  19. git reset --hard HEAD && git pull = force all of git code to somewhere 
  20. git config --global user.name "user_name" = change name of git account
  21. git config -- global user.email "user_email" = change mail of git account
  22. git stash / git stash save "description" = change branch after save code temporarily
  23. git stash pop = fetch / pull code saved temporarily 
  24. git branch --set-upstream-to=remote_path/branch_name --> solve error about git pull no tracking info

Comments

Popular posts from this blog

[Kubernetes] Node Overcommitted

[AWS] What is the Cloud Formation?

How to Install jenkins using Helm chart on instance