1. Basic configuration:
Configure user name: Git config--global user.name "";
Configure mailbox: Git config--global user.email "";
View configuration: Git config--list
2. Basic Operation:
Create warehouse: Go to a directory and execute git init
Use the current polygon directory as a git repository: git add filename
Modify the file to add a line "AAAA"
Git commit-m '//is only submitted to staging area and not submitted to the repository
Git commit-am '//Add to cache and submit to Repository
3. Branch Management:
Git branch//view Branch
GIT branch br//Add BR Branch
Git checkout branch name//Switch Branch
Execute under the Master branch: git merge br//merge BR branches in Master Branch
4. View the log:
git log//normal view
git log--oneline//merge on one line to view
git log--oneline--graph//view in tree form
5. Back to version
Check log first, pointer git log--oneline
git reset--hard head pointer
6. Upload files to GitHub.
1. Register your GitHub account
2. Generate key pair ssh-keygen-t rsa-c [email protected]
3. Give the public key to GitHub
4. Create a warehouse on GitHub, the same as the warehouse name and the local warehouse. The URL of a remote repository is returned after creation is complete
5. Create a remote repository git remote add [shortname] [url]//shortname is the remote connection name, here named Orign
6. View the remote repository git remote-v
7. Upload code to remote repository: git push--set-upstream orign master//orign is the remote connection name for operation 5, master is branch
8. Refresh GitHub to view uploaded items
7. Download the code to the local repository
git fetch
git merge
GIT basic operations and upload code to GitHub