Git入门
Git Concept: Version Control System
Components
Local
- version repository: contains
commits named by their SHA-1 hash - working copy: what you can see in the working director tracking by git.
- stage area: for partial
- shadow copy for remote: store the copy of remote
Remote
Remote repository, fast-forwarding only.
Local Work Flow
Local
1. Edit in Working Copy
- tracking file:
git add,git mv,git rm
2. Commit
Partial
- stage what you want to commit:
git add <file> git restore --staged <file>untrack from stage.- Checkout will be commit:
git status - commit the change file in the stage:
git commit -m <message> git checkout: recover from commit.
All
- commit all the file:
git commit -a -m <message>
Remote
Remote --> Shadow: git fetch
git pull=git fetch+git merge
Version Repository --> Remote: git push
- if Remote is not a subset of Version Repository, you have to
git fetchandgit mergethem first.
Status
git status: what will be commit
git log file/remote: commit history
git log -p: commit history and patches
Git Everyday
Single Person
- git init
- git add
- git commit [--amend [--no-edit] ]
- git restore
- git diff HEAD
- git merge
- git switch [-c or --create]
- git log
- git tag
Participants
(待更新)

浙公网安备 33010602011771号