An interesting little game for learning github commands
All the screenshots in this article are from this mini game and are only for personal study records. If there is any infringement, please contact me to delete
github common commands
- git commit: The commit command will create a new commit record;
- git checkout branchName: switch the branch to the branch named branchName;
- git branch branchName: create a new branch named branchName;
- cat .git/HEAD: Check HEAD points to
- git symbolic-ref HEAD: If HEAD points to a reference, you can use this command to check HEAD points to
Merge branch command (* sign indicates the reference pointed to by HEAD, that is, the reference currently pointed to)
git merge branchName: merge the branchName branch into the branch pointed to by the current reference
git rebase branchName: merge the current branch into the branchName branch (the opposite of the git merge command)
move up the commit tree
- The concept of HEAD
- git checkout commit record name: detach HEAD, let HEAD point to the commit record, not the reference
git checkout branchName^: Find the parent commit of the specified commit record
git checkout branchName~2: Find the parent and parent commit of the specified commit record, equivalent to git checkout branchName^^
git branch -f master HEAD~3: Point the master reference to the parent parent commit record of HEAD, as shown below
revoke order
git reset Relative positioning: roll back to the positioned position ( only valid for local branches, invalid for remote branches ). Relative positioning, such as master~2, represents the first two commit records of the commit record pointed to by the master reference.
- git revert relative positioning: roll back to the positioned position ( valid for remote branches ).