Git distributed version control and code remote repository GitHub
1. Right-click the folder into the open Git Bash here
2, initialize git generate a .git file: git init
As FIG generates a hidden file .git
3, add files to the staging area using the command: git add <filename suffix>
Note that can be used repeatedly to add multiple files;
you can also add all the files in that directory: git the Add .
4, add files to the repository using the command
-m <Description of this submission> Git the commit
Git the commit 'first commit' -m
5, remote repository GitHub
Adding a remote repository:
$ Git remote add origin [email protected]: < GitHub account name> / <repository name> .git $ git the Add Remote [email protected] Origin: BFD2018 /learngit.git
Next, we can put all the contents of the local repository pushed to the remote library main branch master on:
git push -u origin master
Preferably different types of files to be pushed to different remote libraries on different branches
Branch Management:
See branch: git branch create a branch: git branch <branch name> For example: git branch Python_spider handover branch: Git Checkout <branch name> Create + handover branch: git checkout -b <branch name> is equivalent to switching the above two steps to create and combined a branch to the current branch: git Merge <name> delete branch: git branch -d <name>
6, clone library from a remote
git clone <GitHub copied from the address>
For example:
Git clone [email protected]: BFD2018 /wx_miniProgram.git
Summary: Git support multiple protocols, including https, but by native git protocol support ssh fastest speed
7、git 错误error: failed to push some refs to
Manually create a remote repository, a remote repository again push the local library, git will complain error error: failed to push some refs to. Probably the reason is the local and remote files should be merged in order to upload a new file, because there is a remote library file is not READMe.md local library
Solution:
git pull --rebase origin master