GIT-related knowledge
L GIT Installation
L View git documentation
Query the Help document for the Git-checkout command #man git-checkout
Querying the documentation for the git-checkout command #git help Git-checkout
View HTML-formatted documents git help–w git-checkout
Basic usage of Git
- Create repository git init
is divided into the local repository and the remote repository, when using git to manage the source code version, you can communicate directly with the local repository without connecting to the Internet,git, and then communicate with the remote repository after connecting to the Internet.
First, create a working directory of open source projects and enter
#mkdir –p/demo/helloworld-git
#cd/demo/helloworld-git
#git Init
- Submit a file to the local repository git commit
#cd/demo/helloworld-git
#echo "HelloWorld" >helloworld.txt
#git add Helloworld.txt submit to a text library
#git commit–m ' Helloworld-master '
Log messages are displayed #git log
- Create a local branch git branch
#git Branch understand which local branches the yourselves repository contains
#git Branch New-branch to create a new branch
#git branch–d new-branch Delete the branch you just established (all changes made in the branch will disappear)
- Toggle local branch Git checkout
Local branches are designed to isolate changes in different parts of the main branch, and the git checkout command can be used to switch between different local branches.
# git checkout new-branch to switch the current local branch to New-branch
#echo ' Hello World ' >helloworld.txt
#git Add Helloworld.txt
#git commit–m Helloworld-new-branch Modify the contents of the file and resubmit it to the local repository
- Upload source code to github git push
GitHub upload requires SSH checksum, so you need to generate a key file and a public key file
#ssh-keygen–t rsa–c [email protected]
Then set the key to detect if the key setting is correct
#ssh –T [email protected]
Add RSA identity to proxy authentication
#ssh-add
Set uploader name and email
#git config–global user.name "YOUR name"
#git Config–global user.email YOUR Email
Set the URI on GitHub
#git REMOTR Add origin [email protected]:androidguy/helloworld.git
Uploading files from the local repository to GitHub
#git Push–u Origin Master
View all Branches
#git Branch–a
Android Deep Exploration (Vol. 1) HAL and Driver Development--Reading notes (chapter III)