1. Create a repository locally
mkdir mystudygit cd mystudygit git init //create repository ls -a //Check whether the warehouse was created successfully
2. Add files to the repository
git add cxf.txt git commit -m "add cxf.txt commit"
3. Add a remote repository to the local project
//Add a remote warehouse to the project hb_studygit is the alias of the remote warehouse address, this can be written casually, the default is origin //You can add multiple remote repositories git remote add hb_studygit https://github.com/hbiao68/studygit/
View added remote repositories
git remote -v hb_studygit https://github.com/hbiao68/studygit/ (fetch) hb_studygit https://github.com/hbiao68/studygit/ (push)
// "Push" the local code to the remote server (push the local master branch to the remote master branch)
git push hb_studygit master
Fourth, download the warehouse from github
/ / Clone the remote warehouse to the local warehouse name is msgmail git clone https://github.com/hbiao68/msgmail msgmail
expand
//fetch data from remote warehouse
git fetch [remote-name]
// push data to remote warehouse
git push origin master
//delete the remote warehouse
git remote rm name
Strong push, that is, using strong coverage to replace the content of the remote git repository with the local code
git push -f origin
Commit the local test branch as the remote master branch
git push origin test:master
Commit the local master branch to the remote master branch
git push origin master
Push the current branch to the branch corresponding to the origin, for example: currently in the master branch, the local changes will be pushed to the remote master branch
git push origin
//Rename the remote repository
git remote rename old_name new_name