引用文章来源
转载已注明出处。文章来源于网络,如有侵权,请联系删除。
概括简要
tree -a
mkdir
cd
printf 'a' > data/letter.txt
git init
tree .git/objects
git add data/letter.txt
blob file -> .git/objects/2e/65
git cat-file -p 2e65
-> a
cat .git/index
git ls-files -s
git commit -m 'a1'
cat .git/HEAD
cat .git/refs/heads/main
git checkout 1f48
-> detached HEAD -> check out commit
git checkout main
-> check out branch
git merge branch
-> merge a ancestor(nothing)/descendant(ref/HEAD was changed)
different lineages
Commits can share parents
HEAD current branch
git merge main -m 'b4'
git branch -a
$ git commit -m "Something terribly misguided" # (0: Your Accident)
$ git reset HEAD~ # (1)
[ edit files as necessary ] # (2)
$ git add . # (3)
$ git commit -c ORIG_HEAD # (4)
CONFICT
cat .git/index
git ls-files -s
stage 0 1 2 3… working copy -> git add -> .git/index -> git commit….
To exit git log, type “q” or “z”. Or type “h” to seek for help.
Please enter a commit message…
git rm ...
cd ..
cp -R file_a file_b
git remote add file_name path
cat .git/config
git pull repo_name main
-> git fetch repo_name main
-> cat .git/refs/remotes/repo_name/main
-> tree .git/refs
-> cat .git/FETCH_HEAD
-> git merge FETCH_HEAD -> Fast-forward (merge a descendant)
git clone repo_name repoB_name --bare -> no working copy
git push repo_A repo_B
简评
分享
如果你喜欢这篇文章的话,欢迎转发、分享。😁