mvn-quangtran-dn / GIT-PHP

0 stars 0 forks source link

G1_Nguyen_Huu_Khanh #16

Open mvn-khanhnguyen-dn opened 6 years ago

mvn-khanhnguyen-dn commented 6 years ago

GIT group command 1

Git init

Khởi tạo git dưới local git init gitinit

Git clone

Clone repo trên git xuống local git clone {url repo} gitclone

Git remote add

git remote add {name} {repo} Thêm remote name với url là repo gitremote1 gitremote2

Git branch

git branch Xem các branch đang có gitbranch

GIT group command 2

Create new branch

git branch {name} Tạo branch mới tên name createbranch

Delete branch

git branch -D {name} Xóa branch tên name deletebranch

Create and switch branch

git checkout -b {name} Tạo và chuyển sang branch name createandswitchbranch

Git add

git add ./{file} Thêm 1 hoặc nhiều file đã thay đổi để chuẩn bị commit gitadd

Git commit

git commit -m {message} Xác nhận các thay đổi trong file đã add gitcommit

GIT group command 3

Git commit amend

git commit --amend Sửa đổi commit trước đó gitamend

Git log

git log Hiện chi tiết các commit gitlog

Git diff

git diff {file} Xem sự khác nhau của file trước và sau khi sửa gitdifffile

Git diff branch

git diff {branch1} {branch2} So sánh branch1 với branch2 gitdiffbranch

Git checkout file

git checkout HEAD~{number} {file} Đưa file về trạng thái trước number lần commit gitcheckoutfile

GIT group command 4

Git reset

git reset HEAD~{number} Hủy bỏ number lần commit trước đó gitreset1

Git revert

git revert HEAD~{number} Quay lại trạng thái trước number lần commit bằng cách tạo 1 commit mới gitrevert2

Git log oneline

git log --oneline Hiện log mỗi lần commit trên 1 dòng gitlogoneline

GIT group command 5

Git fetch

git fetch origin Lấy file từ branch trên server về branch local gitfetch

Git pull

git pull origin master Lấy và merge nội dung trên repo vào local gitpull

Git push

git push origin {branch} Đẩy nội dung đã commit lên branch gitpush

GIT group command 6

Create conflict

  1. Tạo branch mới từ master conflict1
  2. Sửa file trong branch mới và commit conflict2
  3. Sửa file trong branch master và commit conflict2
  4. Merge branch mới và master ==> Conflict conflict3

    Solve conflict

  5. Sửa file bị conflict solveconflict
  6. Commit và merge lại ==> solved conflict solveconflict2

    GIT group command 7

    Git stash

    git stash orr git stash save {message} Tạo 1 snapshot cho phiên làm việc hiện tại và lưu vào 1 stack git stash 1 git stash 2

    Git stash list

    git stash list Liệt kê các stash hiện có trong stack git stash list

    Git stash show

  7. git stash show để chỉ ra sự khác nhau giữa phiên hiện tại và stash cuối git stash show
  8. git stash show stash@{stash} để chỉ ra sự khác nhau giữa phiên hiện tại và stash được chỉ định git stash show 1

    Git stash apply

    git stash apply stash@{n} Lấy lại phiên làm việc n trong stash git stash apply

    Git stash pop

    git stash pop Quay lại phiên làm việc cuối và xóa nó khỏi stack của stash git stash pop

    Git stash drop

    git stash drop or git stash drop stash@{n} Xóa stash cuối hoặc stash chỉ định trong stack git stash drop

    Git stash clear

    git stash clear Xóa tất cả stash git stash clear

mvn-quangtran-dn commented 6 years ago
mvn-khanhnguyen-dn commented 6 years ago

Em đã update issues, cảm ơn anh @at-quangtran đã review giúp em ạ!