Git: git commands

Git Commands

๐Ÿšš Run Locally

Frequently used commands. This is a helpful page to Git or Github.

In the git bash , ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ ๋ฉ”์ผ ์„ค์ •:

 git config --global user.name "HJ"
 git config --global user.mail "floralcustom@gmail.com"

Config check, use:

git config --list
git config user.name
git config --show-origin user.name //์ตœ์ดˆ ์„ค์ • ํ™•์ธ

End of line :

์‹œ์Šคํ…œ์„ค์ •๋Œ€๋กœ : git config โ€”global core.eof native
์‹œ์Šคํ…œ์„ค์ •๋Œ€๋กœ : git config โ€”global core.autcrlf false

Diff result Highlighting :

git config -global pager.diff โ€˜diff-highlight | lessโ€™

Create Local repository :

mkdir project
cd project
git init
git add *
git commit -m โ€œMy first version managing directoryโ€

์ €์žฅ์†Œ ๋‚ด๋ ค๋ฐ›๊ธฐ :

git clone id@์›๊ฒฉ์ €์žฅ์†Œ_URL
git clone /๋กœ์ปฌ์ €์žฅ์†Œ/์ €์žฅ์†Œ

File ์ƒํƒœ ํ™•์ธ(Tracked : Modified/Unmodified/Staged, Untracked : Unstaged) :

git statusgit status -s :
: OO filename
: First O - Staging ์ƒํƒœ๋ฅผ ๋ณด์—ฌ์คŒ
: Second O - Working directory ์ƒํƒœ๋ฅผ ๋ณด์—ฌ์คŒ
: M - Modifyed
: A - Added
: ? - Unstaged
Staging Area file์„ Unstage๋กœ ๋ณ€๊ฒฝํ•˜๊ธฐ
    git reset HEAD filename
    git checkout โ€” filename

Comments