Git Production Sheet: Branching & Rebase

๐Ÿ’ก Git Production Sheet: Branching & Rebase โ€” Executive Summary

Technical architectural analysis, practical configuration manifests, and deployment instructions for Git Production Sheet: Branching & Rebase.

Concepts

Connection Link
Status
  • untracked
  • Newly added file, not tracked by Git.
  • You must run git add to switch to staged state.
  • tracked
  • File already being tracked by Git.
  • Detailed status:
    • unstaged: Changes made in tracked files but not added to staged status.
    • Can be included in commit contents using git commit -a command
    • staged: Changes are staged with git add. Included in the next commit.

Exec

Starting a workspace (see: git help tutorial)
clone

Clone the repository and import it into a new directory

bash
git clone ${git_repository}
init

Create an empty Git repository or reinitialize an existing one

bash
git init
config

Manage settings metadata

bash
# ๊ธฐ๋ณธ ํŽธ์ง‘๊ธฐ๋ฅผ vim์œผ๋กœ ์„ค์ •
git config --global core.editor "vim" 

# ์ „์ฒด ๋ชฉ๋ก ์กฐํšŒ
git config -l

# ํ˜„์žฌ config ์กฐํšŒ
git config user.name
git config user.email

# ํŠน์ • property ์ˆ˜์ • (global)
git config --global user.name {{ new name }}
git config --global user.email {{ new email }}

# config ์‚ญ์ œ
git config --unset {{ var name }}

# fastfoward ์„ค์ •
git config merge.ff false    # ๋ธŒ๋žœ์น˜ ๋ณ‘ํ•ฉ ์‹œ ํ•ญ์ƒ ๋ณ‘ํ•ฉ ์ปค๋ฐ‹ ์ƒ์„ฑ
git config pull.ff only      # pull์€ fast-forward๋กœ๋งŒ (๋นˆ ๋ณ‘ํ•ฉ ์ปค๋ฐ‹ ๋ฐฉ์ง€)
git config --get merge.ff    # false
git config --get pull.ff     # only


# edit mode
git config -e
git config --global -e

# credential ์‚ญ์ œ
git config --unset credential.helper

# credential ์ €์žฅ
git config --global credential.helper store
git config credential.helper store

# credential ์ž„์‹œ์ €์žฅ
git config credential.helper cache
git config credential.helper 'cache --timeout 7200'
remote

Upstream Management

bash
# remoteName์œผ๋กœ repository ๋“ฑ๋ก
git remote add $remoteName $remoteAddr

# origin์— repository ๋“ฑ๋ก
git remote add -f origin $remoteAddr

# remote url ํ™•์ธ
git remote get-url $remote_name

# git remote ์ „์ฒด์ •๋ณด ํ™•์ธ
git remote -v
update-index
bash
#ํ•ด๋‹น ๊ฒฝ๋กœ์˜ ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ์ง€์†์ ์œผ๋กœ ์ถ”์ ํ•˜์ง€ ์•Š์Œ
git update-index --assume-unchanged ${fileDir}

#assume-unchanged ํ•ด์ œ
git update-index --no-assume-unchanged ${fileDir}
lfs

large format storage

bash
# .gitattribute์— lfs ์ถ”์ ์ •๋ณด ์ถ”๊ฐ€
git lfs track "*.extension"

# lfs์—์„œ ๋กœ์ปฌ๋กœ ๊ฐ€์ ธ์˜ด
git lfs pull
Working with changes (see: git help everyday)
add

Add file contents to index

bash
# ๊นƒ untracked file ์ „์ฒด tracking
git add -A

# ํŠน์ • directory๋งŒ tracking
git add ${dir}
mv

Move or rename files, directories, and symbolic links

References and Guidelines (NOTE)

Differences from mv

  • mv ${oldfile} ${newfil} and then git status
bash
deleted:    oldfile
  untracked:  newfile
  • git mv ${oldfile} ${newfile} and then git status
bash
renamed: oldfile -> newfile
bash
git mv ${oldfile} ${newfile}
restore

Restore working tree files

bash
#unstaged to discard changes
git restore $file

#staged to unstaged
git restore --staged $file
rm

Remove the file from the working folder and remove it from the index

bash
# git index์—์„œ ์ œ๊ฑฐ(untracked) ๋ฐ ํŒŒ์ผ์‹œ์Šคํ…œ์—์„œ ์‚ญ์ œ
git rm -r ${dir}
git rm ${file}

# git index์—์„œ๋งŒ ์ œ๊ฑฐ(untracked)
### .gitignore์— ์ถ”๊ฐ€ํ•œ ํ›„์— ์ถ”์ ์ค‘๋‹จ ๋“ฑ
git rm -rf --cached .
View commit history and status (Reference: git help revisions)
bisect

Find the commit that created the bug using binary search

bash
# ๋‚˜์œ(๋ฒ„๊ทธ๊ฐ€ ๋ฐœ์ƒํ•œ) ์ปค๋ฐ‹ ์ง€์ •
git bisect bad

# ์ข‹์€(๋ฒ„๊ทธ๊ฐ€ ์—†๋˜) ์ปค๋ฐ‹ ์ง€์ •
git bisect good ${commit_hash}

# --no-checkout ์˜ต์…˜์€ ์›Œํ‚น ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ „ํ™˜ํ•˜์ง€ ์•Š๊ณ  ๋‹จ์ง€ ์ปค๋ฐ‹ ํ•ด์‹œ๋งŒ ์ถ”์ 
# ์Šคํฌ๋ฆฝํŠธ๋‚˜ CI์—์„œ ๋ณ„๋„์˜ ์ฒดํฌ์•„์›ƒ/๋นŒ๋“œ ์—†์ด ์ปค๋ฐ‹ ๋‹จ์œ„ ๋น„๊ต
git bisect start --no-checkout
diff

View changes between commits, commits and work details, etc.

bash
# ๋งˆ์ง€๋ง‰ ์ปค๋ฐ‹ <-> ๋กœ์ปฌ ์ฐจ์ด ํ™•์ธ
git diff ${file}

# ๋ธŒ๋žœ์น˜๊ฐ„ ํŒŒ์ผ ์ฐจ์ด ํ™•์ธ
git diff ${targetBranch} ${sourceBranch} -- ${file}
grep

Display lines that match the pattern

bash
#๊ฒ€์ƒ‰์–ด์™€ ์ผ์น˜ํ•˜๋Š” ํŒŒ์ผ ๋น ๋ฅด๊ฒŒ ์ถœ๋ ฅ
git grep ${searchText}

#๊ฒ€์ƒ‰์–ด์™€ ์ผ์น˜ํ•˜๋Š” ํŒŒ์ผ๊ณผ ๋ผ์ธ๋„˜๋ฒ„๋ฅผ ๋น ๋ฅด๊ฒŒ ์ถœ๋ ฅ
git grep --line-number ${searchText}
log

Show commit history

bash
# ํ˜„์žฌ ๋ธŒ๋žœ์น˜ ๋‚ด ์ปค๋ฐ‹๋‚ด์—ญ ํ™•์ธ
git log

# ์š”์•ฝ์œผ๋กœ ์ถœ๋ ฅ
git log --oneline

# ๋ชจ๋“  ๋ธŒ๋žœ์น˜ ์ปค๋ฐ‹๋‚ด์—ญ ํ™•์ธ
git log --all

# ๋ชจ๋“  ๋ธŒ๋žœ์น˜์—์„œ ํ•ด๋‹น ๋จธ์‹ ๊ธฐ์ค€ dir ํŒจ์Šค๋ฅผ ํฌํ•จํ•˜๋Š” ์ปค๋ฐ‹์ด๋ ฅ ํ™•์ธ (๋””๋ ‰ํ† ๋ฆฌ์˜ ์ตœ์‹ ์ปค๋ฐ‹ ๋ธŒ๋žœ์น˜ ์ฐพ๊ธฐ)
git log --all -- ${dir_path}

# ๋ธŒ๋žœ์น˜, ๋ณ‘ํ•ฉ ํ๋ฆ„์„ ์‹œ๊ฐํ™”
git log --graph

# ํƒœ๊ทธ ๋“ฑ์„ ๊ฐ™์ด ํ‘œ์‹œ
git log --decorate

# ๋‹ค ๋ณด๊ธฐ
git log --oneline --decorate --graph --all
show

Displays various types of objects

bash
# commitId๋กœ ๋ณ€๊ฒฝ๋‚ด์—ญ ํ™•์ธํ•˜๊ธฐ (pagered)
git show ${commitId}
status

Shows working folder status

bash
git status
Growing, displaying, and manipulating commit history
backfill

Download missing objects in a partial clone

bash
# ๋ถ€๋ถ„ํด๋ก ์œผ๋กœ ์ธํ•ด ๋ฐœ์ƒํ•œ ๋ˆ„๋ฝ blob์„ ์ฑ„์›Œ์„œ ์—…์ŠคํŠธ๋ฆผ๊ฐ„์˜ ์„ฑ๋Šฅ์ €ํ•˜๋ฅผ ๊ฐœ์„ ํ•จ.
git backfill
branch

Create, delete, or list branches

bash
# ํ˜„์žฌ ๋ธŒ๋žœ์น˜ ํ™•์ธ (๋กœ์ปฌ)
git branch

# ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ (๋กœ์ปฌ)
git branch ${branchname}

# ๋ธŒ๋žœ์น˜ ์ด๋ฆ„ ๋ณ€๊ฒฝ (๋กœ์ปฌ)
git branch -m ${before_branchname} ${new_branchname}

# ๋ธŒ๋žœ์น˜ ์‚ญ์ œ (๋กœ์ปฌ) -- ๋ณ‘ํ•ฉ๋œ ๋ธŒ๋žœ์น˜๋งŒ ์‚ญ์ œํ•จ
git branch -d ${branchname}

# ๋ธŒ๋žœ์น˜ ์‚ญ์ œ (๋กœ์ปฌ)
git branch -D ${branchname}

# ๋ฆฌ๋ชจํŠธ์™€์˜ ์—ฐ๊ฒฐ์„ ํ•ด์ œ
git branch --unset-upstream

# ๋ฆฌ๋ชจํŠธ(origin)๊ณผ ์—ฐ๊ฒฐ
git branch --set-upstream-to=origin/$branchname

# ๋ฆฌ๋ชจํŠธ ํ•ด์ œ ํ›„ ์—ฐ๊ฒฐ (๋ฆฌ๋ชจํŠธ์ •๋ณด ๋ณ€๊ฒฝ)
git branch -u origin/$branchname

# ์ถ”์  remote ๋ธŒ๋žœ์น˜ ํ™•์ธ
git branch -vv
commit

Record changes to the repository

bash
# commit ๋ฉ”์„ธ์ง€ ์ž…๋ ฅ
git commit -m "${message}"

# ๋งˆ์ง€๋ง‰ ์ปค๋ฐ‹๋ฉ”์„ธ์ง€ ๋ณ€๊ฒฝ and ํ˜„์žฌ status๋ฅผ ๊ธฐ์กด ์ปค๋ฐ‹์— ํฌํ•จ
git commit --amend -m "$message"
revert

Creates a commit that is negative of the specified commit.

References and Guidelines (NOTE)

The revert order is the reverse of the commit order: from the commit closest to HEAD

bash
# ์ทจ์†Œ์ปค๋ฐ‹ ์ƒ์„ฑ
git revert $commitid
# ์ทจ์†Œ์ปค๋ฐ‹ ์ƒ์„ฑ (์—ฌ๋Ÿฌ๊ฑด์˜ revert ์ปค๋ฐ‹)
git revert $commitid1 $commitid2 $commitid3

# ์ปค๋ฐ‹ ์ƒ์„ฑํ•˜์ง€์•Š๊ณ  ๋กœ์ปฌ์— ์Šคํ…Œ์ด์ง€.
git revert -n $commitid3 $commitid2 $commitid1

# merge์ปค๋ฐ‹ ๋˜๋Œ๋ฆฌ๊ธฐ
## ์ผ๋ฐ˜์ ์ธ ์ƒํ™ฉ: ๋ถ€๋ชจ์ปค๋ฐ‹์„ ๊ธฐ์ค€์œผ๋กœ ์ž์‹์ปค๋ฐ‹์„ ๋˜๋Œ๋ฆผ (main <- feature ๋ณ‘ํ•ฉ ์ดํ›„ feature revert)
git revert -m1 $merge_commitid
## ์˜ˆ์™ธ์ ์ธ ์ƒํ™ฉ: ์ž์‹์ปค๋ฐ‹์„ ๊ธฐ์ค€์œผ๋กœ ๋ถ€๋ชจ์ปค๋ฐ‹์„ ๋˜๋Œ๋ฆผ
git revert -m2 $merge_commitid
merge

Combines multiple development records into one

bash
# ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜์˜ ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ํ˜„์žฌ ๋ธŒ๋žœ์น˜๋กœ ๋ณ‘ํ•ฉํ•˜๊ธฐ: history๋ฅผ ๊ณต์œ ํ•˜๋Š” ๋‚ด์šฉ๋งŒ ๊ฐ€๋Šฅ
git merge $branch
rebase

Apply the commit at the top of another base end

bash
## ์—ฌ๋Ÿฌ ์ปค๋ฐ‹ ํ•œ์ค„๋กœ ๋ณ‘ํ•ฉ (์ƒ์œ„ 2์ค„)
git rebase -i HEAD~2
>>>
pick c16a048 bitnami charts: prometheus, grafana, rabbitmq
pick 32aea8b dsfsdfsd

->
# ํ•ฉ์ณ์ ธ์„œ ์‚ฌ๋ผ์งˆ ๋ฉ”์„ธ์ง€๋ฅผ s๋กœ ๋ณ€๊ฒฝ
pick c16a048 bitnami charts: prometheus, grafana, rabbitmq
s 32aea8b dsfsdfsd
<<<



## ์ปค๋ฐ‹ drop (์ƒ์œ„ 1์ค„)
git rebase -i HEAD~1
>>>
pick c16a048 bitnami charts: prometheus, grafana, rabbitmq

->
# ์‚ฌ๋ผ์งˆ ๋ฉ”์„ธ์ง€๋ฅผ drop์œผ๋กœ ๋ณ€๊ฒฝ
drop c16a048 bitnami charts: prometheus, grafana, rabbitmq
<<<


# rabase ์ทจ์†Œ
git rebase --abor
reset

Reset the current HEAD to the specified state

bash
# ๋งˆ์ง€๋ง‰ ์ปค๋ฐ‹ ์ œ๊ฑฐ
git reset HEAD^

# ๋ณ€๊ฒฝ์‚ฌํ•ญ ๋กค๋ฐฑํ•˜๊ธฐ (ํ˜„์žฌ ์ปค๋ฐ‹ ๊ธฐ์ค€)
git reset --hard

# ํŠน์ • ์ปค๋ฐ‹์œผ๋กœ ๋˜๋Œ๋ฆฌ๊ธฐ (๊ณต์œ ๋ธŒ๋žœ์น˜์—์„œ๋Š” ์œ„ํ—˜ํ•  ์ˆ˜ ์žˆ์Œ)
git reset --hard ${commitId}
checkout

Restore files based on branch or specific commit

bash
# ํ•ด๋‹น ๋ธŒ๋žœ์น˜๋กœ ๋ณ€๊ฒฝ
git checkout ${branchname}

# ํ˜„์žฌ ๋ธŒ๋žœ์น˜์—์„œ ์‹ ๊ทœ ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ์„ฑ ํ›„ ์‹ ๊ทœ ๋ธŒ๋žœ์น˜๋กœ ๋ณ€๊ฒฝ
git checkout -b ${new_branchname}

# root ๋ธŒ๋žœ์น˜์—์„œ ์‹ ๊ทœ ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ ํ›„ ์‹ ๊ทœ ๋ธŒ๋žœ์น˜๋กœ ๋ณ€๊ฒฝ
git checkout -b ${new_branchname} ${root_branchname}

# commitID๋ฅผ ์ด์šฉํ•˜์—ฌ ํŠน์ • ์ปค๋ฐ‹ ํŒŒ์ผ ๊ฐ€์ ธ์˜ค๊ฑฐ๋‚˜ ๋˜๋Œ๋ฆฌ๊ธฐ (ํ˜„์žฌ ๋ธŒ๋žœ์น˜ ํ˜น์€ ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜)
git checkout ${commitId} ${file_or_dir}

# ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜์˜ (์ตœ์‹  ์ปค๋ฐ‹) ํŠน์ • ํŒŒ์ผ ๊ฐ€์ ธ์˜ค๊ธฐ
git checkout ${otherBranchname} -- ${file}

# ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜์˜ (์ตœ์‹  ์ปค๋ฐ‹) ํŠน์ • ํŒŒ์ผ ๊ฐ€์ ธ์˜ค๊ธฐ (ํ˜„์žฌ๊ฒฝ๋กœ ๊ธฐ์ค€ ๋ช…์‹œ)
git checkout ${otherBranchname} ${file_or_dir}
cherry-pick

Replication of commits between branches that do not share commit history

bash
# ํŠน์ • ์ปค๋ฐ‹ ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜์—์„œ ๊ฐ€์ ธ์˜ค๊ธฐ
git cherry-pick $commitId

# ์ฒด๋ฆฌํ”ฝ ์ทจ์†Œ
git cherry-pick --abort
stash

Temporarily save the current stage so that it does not affect the commit history

bash
# stash ๋ฐฐ์—ด์— ์ถ”๊ฐ€
git stash

# ๋ฉ”์„ธ์ง€ ์ ์œผ๋ฉด์„œ stash
git stash -m "${message}"

# list ํ™•์ธ
git stash list

# unstash
git stash pop
switch

Switch branches

References and Guidelines (NOTE)

Because checkout includes various functions such as restoring a specific file or moving to a commit ID, a specialized branch command was created for a modern design.

bash
# ํ•ด๋‹น ๋ธŒ๋žœ์น˜๋กœ ๋ณ€๊ฒฝ
git switch ${branchname}

# ํ˜„์žฌ ๋ธŒ๋žœ์น˜์—์„œ ์‹ ๊ทœ ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ์„ฑ ํ›„ ์‹ ๊ทœ ๋ธŒ๋žœ์น˜๋กœ ๋ณ€๊ฒฝ
git switch -c ${new_branchname}

# root ๋ธŒ๋žœ์น˜์—์„œ ์‹ ๊ทœ ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ ํ›„ ์‹ ๊ทœ ๋ธŒ๋žœ์น˜๋กœ ๋ณ€๊ฒฝ
git switch -c ${new_branchname} ${root_branchname}
tag

Create, mark, or delete tags or verify GPG signatures

bash
git tag ${tagname}
worktree

Manage multiple branches with a file system

References and Guidelines (NOTE)

git switch is not possible with a branch registered in the work tree.

bash
fatal: '${branchname}' is already used by worktree at '${workdir}'
bash
# ๋“ฑ๋ก๋œ ์›ŒํฌํŠธ๋ฆฌ ๋ชฉ๋ก ์กฐํšŒ
git worktree list

# ํ˜„์žฌ ๋ธŒ๋žœ์น˜ ๊ธฐ์ค€์œผ๋กœ ํ•ด๋‹น ๊ฒฝ๋กœ์— ์‹ ๊ทœ ์ž‘์—…๊ฒฝ๋กœ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์›ŒํฌํŠธ๋ฆฌ์— ์ €์žฅ
git worktree add ${git_root}/../${new_dir}
git worktree add ${new_workdir}

# ์›ŒํฌํŠธ๋ฆฌ๋ฅผ ์ƒ์„ฑํ• ๋•Œ์— ํ˜„์žฌ ๋ธŒ๋žœ์น˜ ๊ธฐ์ค€์œผ๋กœ ๊ธฐ์กด๋ธŒ๋žœ์น˜ ๋ฆฌ์…‹ ํ˜น์€ ์‹ ๊ทœ๋ธŒ๋žœ์น˜๋ฅผ ์ƒ์„ฑ
git worktree add ${new_workdir} -B ${branchname}

# ์›ŒํฌํŠธ๋ฆฌ๋ฅผ ์ƒ์„ฑํ• ๋•Œ์— ํ˜„์žฌ ๋ธŒ๋žœ์น˜ ๊ธฐ์ค€์œผ๋กœ ์‹ ๊ทœ๋ธŒ๋žœ์น˜๋ฅผ ์ƒ์„ฑ
git worktree add ${new_workdir} -b ${new_branchname}

# ์›ŒํฌํŠธ๋ฆฌ๋ฅผ ์‚ญ์ œ
git worktree remove ${workdir}
Collaboration (see: git help workflows)
fetch

Download objects and references from other repositories

bash
git fetch
pull

Import or integrate from another repository or another local branch

bash
git pull
push

Update remote references and their associated objects

bash
# ํ˜„์žฌ ๋กœ์ปฌ์ปค๋ฐ‹ ๊ธฐ์ค€ push
git push

# ์‹ ๊ทœ๋กœ์ปฌ ๋ธŒ๋žœ์น˜ upstream์— push
git push --set-upstream origin ${branchname}

# ์—…์ŠคํŠธ๋ฆผ ๋ธŒ๋žœ์น˜ ์‚ญ์ œ
git push origin --delete ${branchname}

# ์—…์ŠคํŠธ๋ฆผ์— ๊ฐ•์ œ๋กœ PUSH (๊ธฐ์กด ์ปค๋ฐ‹๋‚ด์—ญ์ด Push๋œ ๊ฒฝ์šฐ)
git push --force-with-lease origin $branch

# ์—…์ŠคํŠธ๋ฆผ์— ์ปค๋ฐ‹id ๋™์ผํ•  ๊ฒฝ์šฐ replace
git push --all --force
git push --tags --force


The Git concept guides are

bash
# ๊ฐ€์ด๋“œ ๋ชฉ๋ก ์กฐํšŒ
git --help -g

# ๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ๊นƒ ํ•ต์‹ฌ ๋”ฐ๋ผํ•˜๊ธฐ ๋ฌธ์„œ
git --help core-tutorial
# Providing usernames and passwords to Git
git --help credentials
# CVS ์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•œ ๊นƒ
git --help cvs-migration
# diff ์ถœ๋ ฅ ๋ฏธ์„ธ ์กฐ์ •
git --help diffcore
# ๋งค์ผ๋งค์ผ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ตœ์†Œํ•œ์˜ ๊นƒ ๋ช…๋ น์–ด ๋ชจ์Œ
git --help everyday
# Frequently asked questions about using Git
git --help faq
# ๊นƒ ์šฉ์–ด ์‚ฌ์ „
git --help glossary
# ๊นƒ ๋„ค์ž„์ŠคํŽ˜์ด์Šค
git --help namespaces
# Helper programs to interact with remote repositories
git --help remote-helpers
# Mounting one repository inside another
git --help submodules
# ๊นƒ ๋”ฐ๋ผํ•˜๊ธฐ ์•ˆ๋‚ด์„œ
git --help tutorial
# ๊นƒ ๋”ฐ๋ผํ•˜๊ธฐ ์•ˆ๋‚ด์„œ: 2๋ถ€
git --help tutorial-2
# ์ถ”์ฒœํ•˜๋Š” ๊นƒ ํ™œ์šฉ ์ž‘์—… ์ˆœ์„œ์˜ ๊ฐœ์š”
git --help workflows


All Features

Commands for primary users
bash
add                     ํŒŒ์ผ ๋‚ด์šฉ์„ ์ธ๋ฑ์Šค์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค
am                      ๋ฉ”์ผํ•จ์—์„œ ์—ฐ์†๋œ ํŒจ์น˜๋ฅผ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค
archive                 ์ง€์ •ํ•œ ํŠธ๋ฆฌ์— ๋“ค์–ด ์žˆ๋Š” ํŒŒ์ผ์˜ ์•„์นด์ด๋ธŒ๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค
backfill                Download missing objects in a partial clone
bisect                  ์ด์ง„ ํƒ์ƒ‰์œผ๋กœ ๋ฒ„๊ทธ๋ฅผ ๋งŒ๋“ค์–ด๋‚ธ ์ปค๋ฐ‹์„ ์ฐพ์Šต๋‹ˆ๋‹ค
branch                  ๋ธŒ๋žœ์น˜๋ฅผ ๋งŒ๋“ค๊ฑฐ๋‚˜, ์‚ญ์ œํ•˜๊ฑฐ๋‚˜, ๋ชฉ๋ก์„ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค
bundle                  ์•„์นด์ด๋ธŒ ํ˜•ํƒœ๋กœ ์˜ค๋ธŒ์ ํŠธ์™€ ๋ ˆํผ๋Ÿฐ์Šค๋ฅผ ์˜ฎ๊น๋‹ˆ๋‹ค
checkout                ๋ธŒ๋žœ์น˜๋ฅผ ์ „ํ™˜ํ•˜๊ฑฐ๋‚˜ ์ž‘์—… ํŒŒ์ผ์„ ๋ณต๊ตฌํ•ฉ๋‹ˆ๋‹ค
cherry-pick             ๊ธฐ์กด ์ปค๋ฐ‹์œผ๋กœ ๋ฐœ์ƒํ•œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค
citool                  git-commit์˜ ๊ทธ๋ž˜ํ”ฝ ๋Œ€์ฒด ๋ฒ„์ „
clean                   ์ž‘์—… ํด๋”์—์„œ ์ถ”์ ๋˜์ง€ ์•Š๋Š” ํŒŒ์ผ์„ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค
clone                   ์ €์žฅ์†Œ๋ฅผ ๋ณต์ œํ•ด ์ƒˆ ๋””๋ ‰ํ„ฐ๋ฆฌ๋กœ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค
commit                  ๋ฐ”๋€ ์‚ฌํ•ญ์„ ์ €์žฅ์†Œ์— ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค
describe                ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋ ˆํผ๋Ÿฐ์Šค๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์˜ค๋ธŒ์ ํŠธ์— ์ฝ์„ ์ˆ˜ ์žˆ๋Š” ์ด๋ฆ„์„ ๋ถ€์—ฌํ•ฉ๋‹ˆ๋‹ค
diff                    ์ปค๋ฐ‹๊ณผ ์ปค๋ฐ‹ ์‚ฌ์ด, ์ปค๋ฐ‹๊ณผ ์ž‘์—… ๋‚ด์šฉ ์‚ฌ์ด ๋“ฑ์˜ ๋ฐ”๋€ ์ ์„ ๋ด…๋‹ˆ๋‹ค
fetch                   ๋‹ค๋ฅธ ์ €์žฅ์†Œ์—์„œ ์˜ค๋ธŒ์ ํŠธ์™€ ๋ ˆํผ๋Ÿฐ์Šค๋ฅผ ๋‹ค์šด๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค
format-patch            ๋ฉ”์ผ ์ œ์ถœ ์šฉ๋„๋กœ ํŒจ์น˜๋ฅผ ์ค€๋น„ํ•ฉ๋‹ˆ๋‹ค
gc                      ๋ถˆํ•„์š”ํ•œ ํŒŒ์ผ์„ ์ง€์šฐ๊ณ  ๋กœ์ปฌ ์ €์žฅ์†Œ๋ฅผ ์ตœ์ ํ™”ํ•ฉ๋‹ˆ๋‹ค
gitk                    ๊นƒ ์ €์žฅ์†Œ ์‚ดํŽด๋ณด๊ธฐ
grep                    ํŒจํ„ด๊ณผ ์ผ์น˜ํ•˜๋Š” ์ค„์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
gui                     ๊นƒ์˜ ํฌํ„ฐ๋ธ” ๊ทธ๋ž˜ํ”ฝ ์ธํ„ฐํŽ˜์ด์Šค
init                    ๋นˆ ๊นƒ ์ €์žฅ์†Œ๋ฅผ ๋งŒ๋“ค๊ฑฐ๋‚˜ ๊ธฐ์กด ์ €์žฅ์†Œ๋ฅผ ๋‹ค์‹œ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ๋‹ค
log                     ์ปค๋ฐ‹ ๊ธฐ๋ก์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
maintenance             Run tasks to optimize Git repository data
merge                   ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๊ฐœ๋ฐœ ๋‚ด์—ญ์„ ํ•˜๋‚˜๋กœ ํ•ฉ์นฉ๋‹ˆ๋‹ค
mv                      ํŒŒ์ผ, ๋””๋ ‰ํ„ฐ๋ฆฌ, ์‹ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ์˜ฎ๊ธฐ๊ฑฐ๋‚˜ ์ด๋ฆ„์„ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค
notes                   ์˜ค๋ธŒ์ ํŠธ ๋…ธํŠธ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค
pull                    ๋‹ค๋ฅธ ์ €์žฅ์†Œ ๋˜๋Š” ๋‹ค๋ฅธ ๋กœ์ปฌ ๋ธŒ๋žœ์น˜์—์„œ ๊ฐ€์ ธ์˜ค๊ฑฐ๋‚˜ ํ†ตํ•ฉํ•ฉ๋‹ˆ๋‹ค
push                    ์›๊ฒฉ ๋ ˆํผ๋Ÿฐ์Šค ๋ฐ ๊ทธ์™€ ๊ด€๋ จ๋œ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค
range-diff              Compare two commit ranges (e.g. two versions of a branch)
rebase                  ์ปค๋ฐ‹์„ ๋‹ค๋ฅธ ๋ฒ ์ด์Šค ๋์˜ ์ตœ์ƒ์œ„์—์„œ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค
reset                   ํ˜„์žฌ HEAD๋ฅผ ์ง€์ •ํ•œ ์ƒํƒœ๋กœ ์žฌ์„ค์ •ํ™”ํ•ฉ๋‹ˆ๋‹ค
restore                 Restore working tree files
revert                  ๊ธฐ์กด ์ปค๋ฐ‹์„ ๋˜๋Œ๋ฆฝ๋‹ˆ๋‹ค
rm                      ํŒŒ์ผ์„ ์ž‘์—… ํด๋”์—์„œ ์ œ๊ฑฐํ•˜๊ณ  ์ธ๋ฑ์Šค์—์„œ๋„ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค
scalar                  A tool for managing large Git repositories
shortlog                'git log' ์ถœ๋ ฅ์„ ์š”์•ฝํ•ฉ๋‹ˆ๋‹ค
show                    ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์ข…๋ฅ˜์˜ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
sparse-checkout         Reduce your working tree to a subset of tracked files
stash                   ์ž‘์—… ํด๋”์˜ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์ž„์‹œ๋กœ ๋‹ค๋ฅธ ๊ณณ์— ์ €์žฅํ•ฉ๋‹ˆ๋‹ค
status                  ์ž‘์—… ํด๋” ์ƒํƒœ๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
submodule               ํ•˜์œ„ ๋ชจ๋“ˆ์„ ์ดˆ๊ธฐํ™”ํ•˜๊ฑฐ๋‚˜, ์—…๋ฐ์ดํŠธํ•˜๊ฑฐ๋‚˜, ์กฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค
switch                  Switch branches
tag                     ํƒœ๊ทธ๋ฅผ ๋งŒ๋“ค๊ฑฐ๋‚˜, ํ‘œ์‹œํ•˜๊ฑฐ๋‚˜, ์‚ญ์ œํ•˜๊ฑฐ๋‚˜, GPG ์„œ๋ช…์„ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค
worktree                ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์ž‘์—… ํด๋”๋ฅผ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค
Auxiliary commands/operation functions
bash
config                  ์ €์žฅ์†Œ ์˜ต์…˜ ๋˜๋Š” ์ „์ฒด ์˜ต์…˜์„ ๋ณด๊ฑฐ๋‚˜ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค
fast-export             ๊นƒ ๋ฐ์ดํ„ฐ ๋‚ด๋ณด๋‚ด๊ธฐ
fast-import             ๊ณ ์† ๊นƒ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ ๋ฐฑ์—”๋“œ
filter-branch           ๋ฆฌ๋ชจํŠธ ๋ธŒ๋žœ์น˜
mergetool               ๋ณ‘ํ•ฉ ์ถฉ๋Œ ์ƒํ™ฉ์—์„œ ๋ณ‘ํ•ฉ ์ถฉ๋Œ ํ•ด๊ฒฐ ๋„๊ตฌ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค
pack-refs               ํšจ์œจ์ ์ธ ์ €์žฅ์†Œ ์ ‘๊ทผ์„ ์œ„ํ•ด ํ—ค๋“œ์™€ ํƒœ๊ทธ๋ฅผ ๋ฌถ์Šต๋‹ˆ๋‹ค
prune                   ์˜ค๋ธŒ์ ํŠธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ๋„๋‹ฌํ•  ์ˆ˜ ์—†๋Š” ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ชจ๋‘ ์ž˜๋ผ๋ƒ…๋‹ˆ๋‹ค
reflog                  reflog ์ •๋ณด๋ฅผ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค
refs                    Low-level access to refs
remote                  ์ถ”์ ํ•˜๋Š” ์ €์žฅ์†Œ ๋ชจ์Œ์„ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค
repack                  ์ €์žฅ์†Œ์˜ ๋ฌถ์—ฌ์ง€์ง€ ์•Š์€ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ฌถ์Šต๋‹ˆ๋‹ค
replace                 ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ฐ”๊พธ๋Š” ๋ ˆํผ๋Ÿฐ์Šค๋ฅผ ๋งŒ๋“ค๊ฑฐ๋‚˜, ํ‘œ์‹œํ•˜๊ฑฐ๋‚˜, ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค
Auxiliary command / information acquisition function
bash
annotate                ํŒŒ์ผ ์ค„๋งˆ๋‹ค ์ปค๋ฐ‹ ์ •๋ณด๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
blame                   ํŒŒ์ผ ์ค„๋งˆ๋‹ค ๋์— ๋งˆ์ง€๋ง‰์œผ๋กœ ์ˆ˜์ •ํ•œ ๋ฆฌ๋น„์ „๊ณผ ์ž‘์„ฑ์ž๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
bugreport               Collect information for user to file a bug report
count-objects           ๋ฌถ์—ฌ์ง€์ง€ ์•Š์€ ์˜ค๋ธŒ์ ํŠธ์˜ ๊ฐœ์ˆ˜ ๋ฐ ๊ทธ ๋””์Šคํฌ ์‚ฌ์šฉ๋Ÿ‰์„ ์ธก์ •ํ•ฉ๋‹ˆ๋‹ค
diagnose                Generate a zip archive of diagnostic information
difftool                ์ผ๋ฐ˜์ ์ธ diff ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉํ•ด ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
fsck                    ์—ฐ๊ฒฐ์„ ํ™•์ธํ•˜๊ณ  ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ์˜ค๋ธŒ์ ํŠธ๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค
gitweb                  ๊นƒ ์›น ์ธํ„ฐํŽ˜์ด์Šค (๊นƒ ์ €์žฅ์†Œ์— ๋Œ€ํ•œ ์›น ํ”„๋ก ํŠธ์—”๋“œ)
help                    ๊นƒ์˜ ๋„์›€๋ง ์ •๋ณด๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
instaweb                ๋‚ด ์ž‘์—… ์ €์žฅ์†Œ๋ฅผ gitweb์—์„œ ์ฆ‰์‹œ ์‚ดํŽด๋ด…๋‹ˆ๋‹ค
merge-tree              Perform merge without touching index or working tree
rerere                  ์ถฉ๋Œํ•˜๋Š” ๋ณ‘ํ•ฉ์˜ ๊ธฐ๋ก๋œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ๋‹ค์‹œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค
show-branch             ๋ธŒ๋žœ์น˜ ๋ชฉ๋ก๊ณผ ๊ทธ ์ปค๋ฐ‹์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
verify-commit           ์ปค๋ฐ‹์˜ GPG ์„œ๋ช…์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค
verify-tag              ํƒœ๊ทธ์˜ GPG ์„œ๋ช…์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค
version                 Display version information about Git
whatchanged             Show logs with differences each commit introduces
Communicate with others
bash
archimport              Import a GNU Arch repository into Git
cvsexportcommit         ํ•˜๋‚˜์˜ ์ปค๋ฐ‹์„ CVS ์ฒดํฌ์•„์›ƒ์œผ๋กœ ๋‚ด๋ณด๋ƒ…๋‹ˆ๋‹ค
cvsimport               ๋‹ค๋ฅธ ์†Œ์Šค ์ฝ”๋“œ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ์—์„œ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ
cvsserver               ๊นƒ์šฉ CVS ์„œ๋ฒ„ ์—๋ฎฌ๋ ˆ์ดํ„ฐ
imap-send               ํ‘œ์ค€์ž…๋ ฅ์—์„œ ํŒจ์น˜ ๋ชจ์Œ์„ ์ฝ์–ด IMAP ํด๋”๋กœ ๋ณด๋ƒ…๋‹ˆ๋‹ค
p4                      Perforce ์ €์žฅ์†Œ์—์„œ ๊ฐ€์ ธ์˜ค๊ฑฐ๋‚˜ ์ €์žฅ์†Œ๋กœ ์ œ์ถœํ•ฉ๋‹ˆ๋‹ค
quiltimport             ํ˜„์žฌ ๋ธŒ๋žœ์น˜์— quilt ํŒจ์น˜ ๋ชจ์Œ์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค
request-pull            ์˜ˆ์ •๋œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์˜ ์š”์•ฝ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค
send-email              ํŒจ์น˜ ๋ชจ์Œ์„ ๋ฉ”์ผ๋กœ ๋ณด๋ƒ…๋‹ˆ๋‹ค
svn                     ์„œ๋ธŒ๋ฒ„์ „ ์ €์žฅ์†Œ์™€ ๊นƒ ์‚ฌ์ด์˜ ์–‘๋ฐฉํ–ฅ ๋™์ž‘
Low-level commands/operations
bash
apply                   ํŒจ์น˜๋ฅผ ํŒŒ์ผ ๋ฐ/๋˜๋Š” ์ธ๋ฑ์Šค์— ์ ์šฉํ•ฉ๋‹ˆ๋‹ค
checkout-index          ์ธ๋ฑ์Šค์˜ ํŒŒ์ผ์„ ์ž‘์—… ํด๋”๋กœ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค
commit-graph            Write and verify Git commit-graph files
commit-tree             ์ƒˆ ์ปค๋ฐ‹ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค
hash-object             Compute object ID and optionally create an object from a file
index-pack              ๊ธฐ์กด ๋ฌถ์Œ ์•„์นด์ด๋ธŒ์— ๋Œ€ํ•œ ๋ฌถ์Œ ์ธ๋ฑ์Šค ํŒŒ์ผ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค
merge-file              3-๋ฐฉํ–ฅ ํŒŒ์ผ ๋ณ‘ํ•ฉ์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค
merge-index             ๋ณ‘ํ•ฉ์ด ํ•„์š”ํ•œ ํŒŒ์ผ์— ๋Œ€ํ•ด ๋ณ‘ํ•ฉ์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค
mktag                   Creates a tag object with extra validation
mktree                  ls-tree ํฌ๋งท์˜ ํ…์ŠคํŠธ์—์„œ tree-object๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค
multi-pack-index        Write and verify multi-pack-indexes
pack-objects            ์˜ค๋ธŒ์ ํŠธ์˜ ๋ฌถ์Œ ์•„์นด์ด๋ธŒ๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค
prune-packed            ๋ฌถ์Œ ํŒŒ์ผ์— ์ด๋ฏธ ๋“ค์–ด ์žˆ๋Š” ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ถ”๊ฐ€๋กœ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค
read-tree               ํŠธ๋ฆฌ ์ •๋ณด๋ฅผ ์ธ๋ฑ์Šค๋กœ ์ฝ์Šต๋‹ˆ๋‹ค
replay                  EXPERIMENTAL: Replay commits on a new base, works with bare repos too
symbolic-ref            ์‹ฌ๋ณผ๋ฆญ ๋ ˆํผ๋Ÿฐ์Šค๋ฅผ ์ฝ๊ณ , ์ˆ˜์ •ํ•˜๊ณ , ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค
unpack-objects          ๋ฌถ์Œ ์•„์นด์ด๋ธŒ์—์„œ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ํ’€์–ด๋ƒ…๋‹ˆ๋‹ค
update-index            ์ž‘์—… ํด๋”์—์„œ ํŒŒ์ผ ๋‚ด์šฉ์„ ์ธ๋ฑ์Šค์— ๋“ฑ๋กํ•ฉ๋‹ˆ๋‹ค
update-ref              ๋ ˆํผ๋Ÿฐ์Šค์— ์ €์žฅ๋œ ์˜ค๋ธŒ์ ํŠธ ์ด๋ฆ„์„ ์•ˆ์ „ํ•˜๊ฒŒ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค
write-tree              ํ˜„์žฌ ์ธ๋ฑ์Šค์—์„œ ํŠธ๋ฆฌ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค
Auxiliary command / information acquisition function
bash
cat-file                Provide contents or details of repository objects
cherry                  ์—…์ŠคํŠธ๋ฆผ์— ์ ์šฉํ•ด์•ผ ํ•  ์ปค๋ฐ‹์„ ์ฐพ์Šต๋‹ˆ๋‹ค
diff-files              ์ž‘์—… ํด๋”์™€ ์ธ๋ฑ์Šค์˜ ํŒŒ์ผ์„ ๋น„๊ตํ•ฉ๋‹ˆ๋‹ค
diff-index              ํŠธ๋ฆฌ๋ฅผ ์ž‘์—… ํด๋”๋‚˜ ์ธ๋ฑ์Šค์™€ ๋น„๊ตํ•ฉ๋‹ˆ๋‹ค
diff-pairs              Compare the content and mode of provided blob pairs
diff-tree               ๋‘ ๊ฐœ์˜ ํŠธ๋ฆฌ ์˜ค๋ธŒ์ ํŠธ์— ์žˆ๋Š” ๋‚ด์šฉ๊ณผ ๋ธ”๋กญ์˜ ๋ชจ๋“œ๋ฅผ ๋น„๊ตํ•ฉ๋‹ˆ๋‹ค
for-each-ref            ๊ฐ ๋ ˆํผ๋Ÿฐ์Šค์˜ ์ •๋ณด๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค
for-each-repo           Run a Git command on a list of repositories
get-tar-commit-id       git-archive๋กœ ๋งŒ๋“  ์•„์นด์ด๋ธŒ์—์„œ ์ปค๋ฐ‹ ID๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค
ls-files                ์ธ๋ฑ์Šค์™€ ์ž‘์—… ํด๋”์˜ ํŒŒ์ผ์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
ls-remote               ์›๊ฒฉ ์ €์žฅ์†Œ์˜ ๋ ˆํผ๋Ÿฐ์Šค๋ฅผ ์—ด๊ฑฐํ•ฉ๋‹ˆ๋‹ค
ls-tree                 ํŠธ๋ฆฌ ์˜ค๋ธŒ์ ํŠธ์˜ ๋‚ด์šฉ์„ ์—ด๊ฑฐํ•ฉ๋‹ˆ๋‹ค
merge-base              ๋ณ‘ํ•ฉ์— ์‚ฌ์šฉํ•  ์ตœ์„ ์˜ ๊ณตํ†ต ๊ณผ๊ฑฐ ์ปค๋ฐ‹์„ ์ฐพ์Šต๋‹ˆ๋‹ค
name-rev                ์ฃผ์–ด์ง„ ๋ฆฌ๋น„์ „์— ๋Œ€ํ•œ ์‹ฌ๋ณผ ์ด๋ฆ„์„ ์ฐพ์Šต๋‹ˆ๋‹ค
pack-redundant          ์ค‘๋ณต๋œ ๋ฌถ์Œ ํŒŒ์ผ์„ ์ฐพ์Šต๋‹ˆ๋‹ค
rev-list                ์‹œ๊ฐ„ ๋ฐ˜๋Œ€ ์ˆœ์„œ์— ๋”ฐ๋ผ ์ปค๋ฐ‹ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์—ด๊ฑฐํ•ฉ๋‹ˆ๋‹ค
rev-parse               ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์ฐพ์•„๋‚ด์„œ ์กฐ์ •ํ•ฉ๋‹ˆ๋‹ค
show-index              ๋ฌถ์—ฌ์ง„ ์•„์นด์ด๋ธŒ ์ธ๋ฑ์Šค๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
show-ref                ๋กœ์ปฌ ์ €์žฅ์†Œ์˜ ๋ ˆํผ๋Ÿฐ์Šค๋ฅผ ์—ด๊ฑฐํ•ฉ๋‹ˆ๋‹ค
unpack-file             ๋ธ”๋กญ์˜ ๋‚ด์šฉ์œผ๋กœ ์ž„์‹œ ํŒŒ์ผ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค
var                     ๊นƒ์˜ ๋…ผ๋ฆฌ์  ๋ณ€์ˆ˜๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
verify-pack             ๋ฌถ์Œ ๊นƒ ์•„์นด์ด๋ธŒ ํŒŒ์ผ์„ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค
Low-level Commands / Syncing Repositories
bash
daemon                  ๊นƒ ์ €์žฅ์†Œ์— ๋Œ€ํ•œ ์•„์ฃผ ๊ฐ„๋‹จํ•œ ์„œ๋ฒ„
fetch-pack              ๋‹ค๋ฅธ ์ €์žฅ์†Œ์—์„œ ์—†๋Š” ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋‹ค์šด๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค
http-backend            ๊นƒ HTTP ํ”„๋กœํ† ์ฝœ์˜ ์„œ๋ฒ„์ธก ๊ตฌํ˜„
send-pack               ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๊นƒ ํ”„๋กœํ† ์ฝœ์„ ํ†ตํ•ด ๋‹ค๋ฅธ ์ €์žฅ์†Œ๋กœ ํ‘ธ์‹œํ•ฉ๋‹ˆ๋‹ค
update-server-info      ๋‹จ์ˆœ ์„œ๋ฒ„์— ๋„์›€์„ ์ฃผ๋„๋ก ๋ณด์กฐ ์ •๋ณด ํŒŒ์ผ์„ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค

Auxiliary commands/internal use functions

bash
check-attr              gitattributes ์ •๋ณด๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
check-ignore            gitignore / ์ œ์™ธํ•  ํŒŒ์ผ์„ ๋””๋ฒ„๊น…ํ•ฉ๋‹ˆ๋‹ค
check-mailmap           ์—ฐ๋ฝ์ฒ˜์˜ ์ „์ฒด ์ด๋ฆ„๊ณผ ๋ฉ”์ผ ์ฃผ์†Œ๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
check-ref-format        ๋ ˆํผ๋Ÿฐ์Šค ์ด๋ฆ„์˜ ํ˜•์‹์ด ์˜ฌ๋ฐ”๋ฅธ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค
column                  ๋ฐ์ดํ„ฐ๋ฅผ ์—ฌ๋Ÿฌ ์—ด๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค
credential              ์‚ฌ์šฉ์ž ๋น„๋ฐ€ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๊ณ  ์ €์žฅํ•ฉ๋‹ˆ๋‹ค
credential-cache        ๋ฉ”๋ชจ๋ฆฌ์— ์ž„์‹œ๋กœ ์•”ํ˜ธ ์ €์žฅํ•˜๋Š” ๋„์›€ ๋ช…๋ น
credential-store        ๋น„๋ฐ€ ์ •๋ณด๋ฅผ ๋””์Šคํฌ์— ์ €์žฅํ•˜๋Š” ๋„์›€ ๋ช…๋ น
fmt-merge-msg           ๋ณ‘ํ•ฉ ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค
hook                    Run git hooks
interpret-trailers      Add or parse structured information in commit messages
mailinfo                ํ•˜๋‚˜์˜ ๋ฉ”์ผ ๋ฉ”์‹œ์ง€์—์„œ ํŒจ์น˜์™€ ์ž‘์„ฑ์ž ์ •๋ณด๋ฅผ ๋ฝ‘์•„๋ƒ…๋‹ˆ๋‹ค
mailsplit               ๊ฐ„๋‹จํ•œ ์œ ๋‹‰์Šค mbox ์ชผ๊ฐœ๊ธฐ ํ”„๋กœ๊ทธ๋žจ
merge-one-file          git-merge-index์™€ ๊ฐ™์ด ์‚ฌ์šฉํ•˜๋Š” ๊ธฐ๋ณธ ๋„์›€ ํ”„๋กœ๊ทธ๋žจ
patch-id                ํŒจ์น˜์— ๋Œ€ํ•œ ์œ ์ผํ•œ ID๋ฅผ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค
sh-i18n                 ์…ธ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์œ„ํ•œ ๊นƒ์˜ ๊ตญ์ œํ™” ์ค€๋น„ ์ฝ”๋“œ
sh-setup                ๊ณตํ†ต ๊นƒ ์…ธ ์Šคํฌ๋ฆฝํŠธ ์ค€๋น„ ์ฝ”๋“œ
stripspace              ๋ถˆํ•„์š”ํ•œ ๊ณต๋ฐฑ ๋ฌธ์ž๋ฅผ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค
User-facing repository, command and file interfaces
bash
attributes              ๊ฒฝ๋กœ๋งˆ๋‹ค ์†์„ฑ ์ •์˜ํ•˜๊ธฐ
cli                     ๊นƒ ๋ช…๋ นํ–‰ ์ธํ„ฐํŽ˜์ด์Šค ๋ฐ ๊ด€์Šต
hooks                   ๊นƒ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ํ›„ํฌ
ignore                  ์˜๋„์ ์œผ๋กœ ์ถ”์ ํ•˜์ง€ ์•Š๋Š” ํŒŒ์ผ์„ ๋ฌด์‹œํ•˜๊ฒŒ ์ง€์ •ํ•˜๊ธฐ
mailmap                 Map author/committer names and/or E-Mail addresses
modules                 ํ•˜์œ„ ๋ชจ๋“ˆ ์†์„ฑ ์ •์˜ํ•˜๊ธฐ
repository-layout       ๊นƒ ์ €์žฅ์†Œ ๊ตฌ์กฐ
revisions               ๊นƒ์˜ ๋ฆฌ๋น„์ „ ๋ฐ ๋ฒ”์œ„๋ฅผ ์ง€์ •ํ•˜๊ธฐ
Developer-facing file formats, protocols and other interfaces
bash
format-bundle           The bundle file format
format-chunk            Chunk-based file formats
format-commit-graph     Git commit-graph format
format-index            Git index format
format-pack             Git pack format
format-signature        Git cryptographic signature formats
protocol-capabilities   Protocol v0 and v1 capabilities
protocol-common         Things common to various protocols
protocol-http           Git HTTP-based protocols
protocol-pack           How packs are transferred over-the-wire
protocol-v2             Git Wire Protocol, Version 2

Features

Specify a file other than ~/.ssh when working with Git via SSH
bash
GIT_SSH_COMMAND="ssh -i ./opnsense" git clone [email protected]:fredric18/opnsense-backup.git
Change commit message at top 2
bash
#1. rebase ๋ช…๋ น
git rebase -i HEAD~2
>>>
#before
pick 41737dd Change Dir Structure
pick 602a1c8 Change Manifests

#after
e 41737dd Change Dir Structure
pick 602a1c8 Change Manifests
<<<

#cursor๊ฐ€ ์•„๋ž˜๋กœ ๋‚ด๋ ค์˜ด ํ™•์ธ
git log

#2. ์ปค๋ฐ‹๋ฉ”์„ธ์ง€ ๋ณ€๊ฒฝ
git commit --amend

#3. ์ปค์„œ ์ œ์œ„์น˜๋กœ ๋ณ€๊ฒฝ
git rebase --continue
Commit changes in another branch
bash
git stash
git checkout ${other-branch}
git stash pop
Get directory of specific revision
bash
git log #๋ฆฌ๋น„์ „id ํ™•์ธ
git checkout ${commitId} ${dir}
Find and retrieve the latest commit in a specific directory from another branch
bash
git log --all -- ${dir}
git checkout ${commitId} ${dir}
git add ${dir}
git commit
Remove directory git dependencies from external repositories
bash
# ๊นƒ๋””๋ ‰ํ„ฐ๋ฆฌ ์‚ญ์ œ
rm -rf .git
# ์บ์‹œ ์‚ญ์ œ
git rm --cached . -rf
git add -A
git commit
git pull
git push
Push directory retrieved from external repository to another repository (maintain history)
bash
#์‚ฌ์ „์— ๋ฆฌํฌ์ง€ํ† ๋ฆฌ๋Š” ์ƒ์„ฑ์™„๋ฃŒ ๋˜์–ด์žˆ์–ด์•ผ ๊ฐ€๋Šฅ

#๊ธฐ์กด origin ํ™•์ธ ๋ฐ ๋ณ€๊ฒฝ
git remote -v
git remote rename origin origin-old
git remote add origin $new_repository
git remote -v

#์ƒˆ๋กœ์šด origin์— push (์ „์ฒด ๋ธŒ๋žœ์น˜)
git push -u origin --all
#์ƒˆ๋กœ์šด origin์— push (ํƒœ๊ทธ)
git push -u origin --tag
#์ƒˆ๋กœ์šด origin์— push (ํŠน์ • ๋ธŒ๋žœ์น˜)
git push -u origin $branch
Reorganize the forked repository into a private repository
bash
#1. github์—์„œ private repository๋ฅผ ์ƒ์„ฑ

#2. forkํ•œ repository bare clone
git clone --bare $forked_repo_url.git
cd $forked_repo.git

#3. private repository์— mirror push
git push --mirror $private_repo_url.git
Sync the forked repository to the latest
bash
git remote -v
git remote add upstream $upsteamrepository
git fetch upstream
git checkout main
git merge upstream/main
git push origin main
Create PR
bash
#ํฌํฌ๋œ ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ ํ›„ clone
git remote -v
git remote add upstream $upsteamrepository
git checkout -b features/$mybranch

#์ˆ˜์ • ์ž‘์—… ํ›„ push
git push origin $mybranch

#github.com์—์„œ pull request ์ƒ์„ฑ
signed off
bash
#commit message ๋งˆ์ง€๋ง‰์— ์ง€์ •
"Signed-off-by: Author Name <[email protected]>"

#ํ˜น์€ ์ž๋™
git commit -s
git commit -sm "$commitmessage"

#๊ธฐ์กด ์—…๋กœ๋“œ/pushํ•œ ์ปค๋ฐ‹ ๊ฐ•์ œ๋ณ€๊ฒฝ
git rebase HEAD~1 --signoff
git push --force-with-lease origin $branch
Force modification of existing PUSH (only possible if there are no conflicts within the branch)
bash
#์ˆ˜์ •์‚ฌํ•ญ commit ๋ฐ squash
git add $something
git commit
git rebase -i HEAD~2
#1. vim์—์„œ ๋งจ ์œ„๋ฅผ ์ œ์™ธํ•˜๊ณ  ์•„๋ž˜์˜ ์ปค๋ฐ‹์„ pick -> s๋กœ ๋ณ€๊ฒฝ
#2. commitmessage ์‚ญ์ œ

git push --force-with-lease origin $branch
Force modification of existing PUSH (last commit target)
bash
git add $something
git commit --amend 
git push --all --force
git push --tags --force
Delete invalid push
  1. delete push
yaml
git reset --hard HEAD~1
   git push origin HEAD --force
  1. Revert
yaml
git revert HEAD
   git push origin HEAD
Rename the branch and reflect it on the remote
bash
# ํ˜„์žฌ ๋ธŒ๋žœ์น˜ ๋ณ€๊ฒฝ
git branch -m ${old-branch-name} ${new-branch-name}

# ๊ธฐ์กด ์›๊ฒฉ ๋ธŒ๋žœ์น˜ ์‚ญ์ œ
git push origin --delete ${old-branch-name}

# ์ƒˆ๋กœ์šด ์ด๋ฆ„์œผ๋กœ ์›๊ฒฉ์— ํ‘ธ์‹œ
git push origin ${new-branch-name}
Create multiple commits into one revert commit
bash
# ์ปค๋ฐ‹ ์ƒ์„ฑํ•˜์ง€์•Š๊ณ  ๋กœ์ปฌ์— ์Šคํ…Œ์ด์ง€.
git revert -n $commitid3 $commitid2 $commitid1
git commit -m "revert \"$commitid3 $commitid2 $commitid1\""
Safely initialize upstream metadata to the current branch (local failure response)
References and Guidelines (NOTE)

Written in response to failures caused by git worktree

bash
target_branch=develop
# 1. target_branch ๋ธŒ๋žœ์น˜๋กœ ์ฒดํฌ์•„์›ƒ
git checkout ${target_branch}

# 2. ๋กœ์ปฌ target_branch์„ upstream๊ณผ ๋™๊ธฐํ™” (๋ฆฌ์…‹)
git fetch origin
git reset --hard origin/${target_branch}

# 4. ํ•„์š” ์‹œ ๋กœ์ปฌ reflog/HEAD ๋กœ๊ทธ ์ดˆ๊ธฐํ™”
git reflog expire --expire=now --all
git gc --prune=now
If branch deletion fails, change name and delete
bash
git branch -m ${before_branchname} ${new_branchname}
git branch -D ${new_branchname}
Change remote origin address
bash
git_provider_url=(github.com bitbucket.org ...)
# to https
git remote set-url origin https://${git_user}@${git_provider_url}/${vendor_name}/${repository_name}.git
# to ssh
git remote set-url origin git@${git_provider_url}:${vendor_name}/${repository_name}.git

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *