pilhoon / wiki_public

0 stars 0 forks source link

git #14

Open pilhoon opened 4 years ago

pilhoon commented 4 years ago

current commit hash

git show -s git show -s --format=%H https://stackoverflow.com/a/43054947/766330

fatal: git-write-tree: error building trees

git reset --mixed

https://stackoverflow.com/a/16056225/766330

diff of last pull ★

git diff ORIG_HEAD..

https://www.reddit.com/r/git/comments/4m6di4/seeing_a_git_diff_of_last_pull/d3tkl0f?utm_source=share&utm_medium=web2x

git revert

git revert --no-commit 0766c053..HEAD
git commit

https://stackoverflow.com/a/21718540/766330 아예 깔끔하게 다 지우는 방법도 괜찮아보임

git rm -r --cached . && git clean -f -d
git checkout 0d1d7fc3 .
git add --all && git commit -m "revert to 0d1d7fc3"

git show branch:file

https://stackoverflow.com/a/7856446/766330

submodule init

git submodule update --init --recursive

https://stackoverflow.com/a/1032653/766330

checkout remote

git fetch
git checkout branch

https://stackoverflow.com/a/1783426/766330

pilhoon commented 3 years ago

branch

official manual

create

git checkout -b <branch>
# Edit files, add and commit. 
git push -u origin <branch>

https://stackoverflow.com/a/6232535/766330

merge

dry merge

git merge --no-commit --no-ff $BRANCH

undo merge

git merge --abort

https://stackoverflow.com/a/501461/766330

delete

# delete branch locally
git branch -d localBranchName

# delete branch remotely
git push origin --delete remoteBranchName

https://www.freecodecamp.org/news/how-to-delete-a-git-branch-both-locally-and-remotely/