git usage and common commands

git  init

Create a new Git repository in the directory with git init. You can do this anytime, in any directory, completely localized.

git  clone   url

Use git clone to copy a Git repository locally so that you can view the project or make changes.

You can view the branch status of the remote library through the git branch -r command

Create a local branch with git checkout -b dev origin/devdev

Establish a link from the local to the upstream (remote) warehouse - so that the code can be submitted

git branch --set-upstream-to=origin/dev 

untrack master

git branch --unset-upstream master

git add .

Use the git add command to write the content you want to snapshot into the cache, and execute git commit to add the cache content to the repository.

Git records your name and email address for every commit you make, so the first step is to configure your username and email address.

$ git config --global user.name 'runoob'
$ git config --global user.email test@runoob.com

Git also allows you to skip this step with the -a option if you find the git add commit cache process too cumbersome. The command format is as follows :

git commit -a

git commit -m "注释提交内容"


To push a branch from local, use git push origin branch-name

Reference article:

1. http://www.runoob.com/git/git-basic-operations.html (basic tutorial)

2. https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013760174128707b935b0be6fc4fc6ace66c4f15618f8d000 (commit branch)

3、https://www.cnblogs.com/bluestorm/p/6252900.html

4、https://stackoverflow.com/questions/21264738/error-src-refspec-master-does-not-match-any

5. https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001375840202368c74be33fbd884e71b570f2cc3c0d1dcf000 (conflict resolution)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326487742&siteId=291194637