1. Create repository git init
First Use git init to create an empty repository locally, execute the command
#mkdir-P/demo/helloworld-git
#cd/demo/helloworld-git
Create a working directory of open source projects, enter the working directory, execute commands #git init.
2. Submit the file to the local repository -git commit
Enter the directory, create files, add files to the local repository index
#cd/demo/helloworld-git
#echo "HelloWorld" >helloworld.txt
#git Add Helloworld.txt
#git commit-m ' Helloworld-master
3. Create a local branch -git branch
GIT provides a branch, a source code may be done by multiple people, and the developer will create a branch for each modification so that the commit does not affect the code of the main branch after the modification. Show branches:# git branch, build branch:# git branch new-branch.
4. Switch local branch -git checkout
#git checkout new-branch--To switch the local branch to new-branch
5. Create an open source project on GitHub.
6. Upload the source code to GitHub git push
GitHub uploads code as neededSSHCheck, use command "# ash-keygen-t Rsa-c "RegisterGitHubwhen you enter theEmail "", in~/.sshgenerate a key file in the directoryId_rsaand a public key fileid_rsa.pub, if these two files already exist, you need to back up. #ssh-T [email protected]--detects the public key, the secret key, and the correct settings just now. Use the command "# Git push-u Origin master"uploads files from the local repository toGitHub.
7. Download Source code -git clone from GitHub
Execute the command "# git clone Engineering Catalog" To download the entire project you need. To get the latest content for a branch, you can use the command "# Git pull Origin master".
Getting Started with Git