본문 바로가기
Programming/Git

[Git] Git Version Command

by skyrun 2022. 10. 8.

Working Status ->(git add) Stage -> (git commit) Repository

 

git init : Initialize Repository

(You need to do it at the directory, you want to manage)

(At FINDER : Shift + Command + . to see hidden files)

git status : Working Status

git add : Add to Staging Area

(Staging to “.git/index” File)

git commit : Create a Version

git commit -am “message” => For the file once committed, “git add” & “git commit” at the same time.

git log : Show Log of Commit

git log  --stat : Show Log and Related File of Commit

git log -p : Show Log and diff of Commit

git diff : Show Changes (Do it before add to stage)

 

Git Status =>Untracked(Never Committed) -> modified -> Modified -> Staged

 

git commit  --amend : Revise the Latest Message.

git restore “file name” : Restore Unstaged File.

git restore  -- staged “file name” : Return to Unstaged Status

git reset HEAD^ : Cancel the Latest Commit
git reset HEAD~3 : Cancel the Latest 3 Commit
git reset “Commit Hash” : Return to that Hash Status
reset Options
--soft HEAD^ : Return to Before the Latest Commit
 --mixed HEAD^ : Return to Before the Latest Commit and Staging
--hard HEAD ^ : Return to Before the Latest Commit and Staging and File Revising.

git reset "Committed Hash" : Return to the "Committed Hash" and Cancelled Commits are Deleted.

git revert “Commit Hash Now” : "Commit Hash Now" Remains but Return to the Previous Commit.

Input Revert Message in the 2nd Line

'Programming > Git' 카테고리의 다른 글

[Git] Git Remote 변경하기  (0) 2022.10.17
[Git] Connect to Github  (0) 2022.10.09
[Git] Branch Command  (0) 2022.10.08
[Git] Git Tips  (2) 2022.10.08
[Git] Linux Command  (0) 2022.10.08

댓글