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 addto switch tostagedstate. tracked- File already being tracked by Git.
- Detailed status:
unstaged: Changes made intrackedfiles but not added tostagedstatus.- Can be included in commit contents using
git commit -acommand staged: Changes are staged withgit 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
git clone ${git_repository}
init
Create an empty Git repository or reinitialize an existing one
git init
config
Manage settings metadata
# ๊ธฐ๋ณธ ํธ์ง๊ธฐ๋ฅผ 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
# 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
#ํด๋น ๊ฒฝ๋ก์ ๋ณ๊ฒฝ์ฌํญ์ ์ง์์ ์ผ๋ก ์ถ์ ํ์ง ์์
git update-index --assume-unchanged ${fileDir}
#assume-unchanged ํด์
git update-index --no-assume-unchanged ${fileDir}
lfs
large format storage
# .gitattribute์ lfs ์ถ์ ์ ๋ณด ์ถ๊ฐ
git lfs track "*.extension"
# lfs์์ ๋ก์ปฌ๋ก ๊ฐ์ ธ์ด
git lfs pull
Working with changes (see: git help everyday)
add
Add file contents to index
# ๊น untracked file ์ ์ฒด tracking
git add -A
# ํน์ directory๋ง tracking
git add ${dir}
mv
Move or rename files, directories, and symbolic links
Differences from mv
mv ${oldfile} ${newfil}and thengit status
deleted: oldfile
untracked: newfile
git mv ${oldfile} ${newfile}and thengit status
renamed: oldfile -> newfile
git mv ${oldfile} ${newfile}
restore
Restore working tree files
#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
# 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
# ๋์(๋ฒ๊ทธ๊ฐ ๋ฐ์ํ) ์ปค๋ฐ ์ง์
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.
# ๋ง์ง๋ง ์ปค๋ฐ <-> ๋ก์ปฌ ์ฐจ์ด ํ์ธ
git diff ${file}
# ๋ธ๋์น๊ฐ ํ์ผ ์ฐจ์ด ํ์ธ
git diff ${targetBranch} ${sourceBranch} -- ${file}
grep
Display lines that match the pattern
#๊ฒ์์ด์ ์ผ์นํ๋ ํ์ผ ๋น ๋ฅด๊ฒ ์ถ๋ ฅ
git grep ${searchText}
#๊ฒ์์ด์ ์ผ์นํ๋ ํ์ผ๊ณผ ๋ผ์ธ๋๋ฒ๋ฅผ ๋น ๋ฅด๊ฒ ์ถ๋ ฅ
git grep --line-number ${searchText}
log
Show commit history
# ํ์ฌ ๋ธ๋์น ๋ด ์ปค๋ฐ๋ด์ญ ํ์ธ
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
# commitId๋ก ๋ณ๊ฒฝ๋ด์ญ ํ์ธํ๊ธฐ (pagered)
git show ${commitId}
status
Shows working folder status
git status
Growing, displaying, and manipulating commit history
backfill
Download missing objects in a partial clone
# ๋ถ๋ถํด๋ก ์ผ๋ก ์ธํด ๋ฐ์ํ ๋๋ฝ blob์ ์ฑ์์ ์
์คํธ๋ฆผ๊ฐ์ ์ฑ๋ฅ์ ํ๋ฅผ ๊ฐ์ ํจ.
git backfill
branch
Create, delete, or list branches
# ํ์ฌ ๋ธ๋์น ํ์ธ (๋ก์ปฌ)
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
# commit ๋ฉ์ธ์ง ์
๋ ฅ
git commit -m "${message}"
# ๋ง์ง๋ง ์ปค๋ฐ๋ฉ์ธ์ง ๋ณ๊ฒฝ and ํ์ฌ status๋ฅผ ๊ธฐ์กด ์ปค๋ฐ์ ํฌํจ
git commit --amend -m "$message"
revert
Creates a commit that is negative of the specified commit.
The revert order is the reverse of the commit order: from the commit closest to HEAD
# ์ทจ์์ปค๋ฐ ์์ฑ
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
# ๋ค๋ฅธ ๋ธ๋์น์ ๋ณ๊ฒฝ์ฌํญ์ ํ์ฌ ๋ธ๋์น๋ก ๋ณํฉํ๊ธฐ: history๋ฅผ ๊ณต์ ํ๋ ๋ด์ฉ๋ง ๊ฐ๋ฅ
git merge $branch
rebase
Apply the commit at the top of another base end
## ์ฌ๋ฌ ์ปค๋ฐ ํ์ค๋ก ๋ณํฉ (์์ 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
# ๋ง์ง๋ง ์ปค๋ฐ ์ ๊ฑฐ
git reset HEAD^
# ๋ณ๊ฒฝ์ฌํญ ๋กค๋ฐฑํ๊ธฐ (ํ์ฌ ์ปค๋ฐ ๊ธฐ์ค)
git reset --hard
# ํน์ ์ปค๋ฐ์ผ๋ก ๋๋๋ฆฌ๊ธฐ (๊ณต์ ๋ธ๋์น์์๋ ์ํํ ์ ์์)
git reset --hard ${commitId}
checkout
Restore files based on branch or specific commit
# ํด๋น ๋ธ๋์น๋ก ๋ณ๊ฒฝ
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
# ํน์ ์ปค๋ฐ ๋ณ๊ฒฝ์ฌํญ์ ๋ค๋ฅธ ๋ธ๋์น์์ ๊ฐ์ ธ์ค๊ธฐ
git cherry-pick $commitId
# ์ฒด๋ฆฌํฝ ์ทจ์
git cherry-pick --abort
stash
Temporarily save the current stage so that it does not affect the commit history
# stash ๋ฐฐ์ด์ ์ถ๊ฐ
git stash
# ๋ฉ์ธ์ง ์ ์ผ๋ฉด์ stash
git stash -m "${message}"
# list ํ์ธ
git stash list
# unstash
git stash pop
switch
Switch branches
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.
# ํด๋น ๋ธ๋์น๋ก ๋ณ๊ฒฝ
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
git tag ${tagname}
worktree
Manage multiple branches with a file system
git switch is not possible with a branch registered in the work tree.
fatal: '${branchname}' is already used by worktree at '${workdir}'
# ๋ฑ๋ก๋ ์ํฌํธ๋ฆฌ ๋ชฉ๋ก ์กฐํ
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
git fetch
pull
Import or integrate from another repository or another local branch
git pull
push
Update remote references and their associated objects
# ํ์ฌ ๋ก์ปฌ์ปค๋ฐ ๊ธฐ์ค 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
# ๊ฐ์ด๋ ๋ชฉ๋ก ์กฐํ
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
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
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
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
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
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
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
daemon ๊น ์ ์ฅ์์ ๋ํ ์์ฃผ ๊ฐ๋จํ ์๋ฒ
fetch-pack ๋ค๋ฅธ ์ ์ฅ์์์ ์๋ ์ค๋ธ์ ํธ๋ฅผ ๋ค์ด๋ก๋ํฉ๋๋ค
http-backend ๊น HTTP ํ๋กํ ์ฝ์ ์๋ฒ์ธก ๊ตฌํ
send-pack ์ค๋ธ์ ํธ๋ฅผ ๊น ํ๋กํ ์ฝ์ ํตํด ๋ค๋ฅธ ์ ์ฅ์๋ก ํธ์ํฉ๋๋ค
update-server-info ๋จ์ ์๋ฒ์ ๋์์ ์ฃผ๋๋ก ๋ณด์กฐ ์ ๋ณด ํ์ผ์ ์
๋ฐ์ดํธํฉ๋๋ค
Auxiliary commands/internal use functions
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
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
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
GIT_SSH_COMMAND="ssh -i ./opnsense" git clone [email protected]:fredric18/opnsense-backup.git
Change commit message at top 2
#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
git stash
git checkout ${other-branch}
git stash pop
Get directory of specific revision
git log #๋ฆฌ๋น์ id ํ์ธ
git checkout ${commitId} ${dir}
Find and retrieve the latest commit in a specific directory from another branch
git log --all -- ${dir}
git checkout ${commitId} ${dir}
git add ${dir}
git commit
Remove directory git dependencies from external repositories
# ๊น๋๋ ํฐ๋ฆฌ ์ญ์
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)
#์ฌ์ ์ ๋ฆฌํฌ์งํ ๋ฆฌ๋ ์์ฑ์๋ฃ ๋์ด์์ด์ผ ๊ฐ๋ฅ
#๊ธฐ์กด 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
#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
git remote -v
git remote add upstream $upsteamrepository
git fetch upstream
git checkout main
git merge upstream/main
git push origin main
Create PR
#ํฌํฌ๋ ๋ธ๋์น ์์ฑ ํ 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
#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)
#์์ ์ฌํญ 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)
git add $something
git commit --amend
git push --all --force
git push --tags --force
Delete invalid push
- delete push
git reset --hard HEAD~1
git push origin HEAD --force
- Revert
git revert HEAD
git push origin HEAD
Rename the branch and reflect it on the remote
# ํ์ฌ ๋ธ๋์น ๋ณ๊ฒฝ
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
# ์ปค๋ฐ ์์ฑํ์ง์๊ณ ๋ก์ปฌ์ ์คํ
์ด์ง.
git revert -n $commitid3 $commitid2 $commitid1
git commit -m "revert \"$commitid3 $commitid2 $commitid1\""
Safely initialize upstream metadata to the current branch (local failure response)
Written in response to failures caused by git worktree
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
git branch -m ${before_branchname} ${new_branchname}
git branch -D ${new_branchname}
Change remote origin address
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




Leave a Reply