1:coding.net Register your account and create a project. You can tick the readme.txt.
2:CD to the native project folder in Git to represent workspace
3:mac users with Ls-all, Linux users with LL or ls-l to see if they already exist. Git folder This folder is repository (local git directory) Delete it if it exists rm-rf. git
4: Set up your git username and mailbox. If it is coding's account, use coding's registered email and username
The command to change the user name of config is
git config--global user.name ' xxx '
The command to change the mailbox is
git config--global user.email ' [email protected] '
5: In git to push the local project to the cloud (for example, coding) must first load into the local index and then push to the GIT workstation mentioned above in the repository
git Add. #表示添加所有文件git add index.html #index. html represents a file name
6: You can use status to view the state of Git after you add it
Chenjiadembp:questionnaire chenjia$ git status
On Branch Master
Nothing to commit, working tree clean
The presence of such a representation has not been uploaded
7:add is then pushed to the GIT workstation with the commit command, which is the repository mentioned above.
git commit-m ' description ' #说明中一般填写提交人的姓名和修改的内容 For example, if I test it, I'll write one.
8: The most critical step to here must not be directly online push must first pull down the version of the coding to reach the version of the same, or will error
To Https://git.coding.net/cjkk/QuestionNaire.git
! [Rejected] Master --Master (fetch first)
Error:failed to push some refs to ' https://git.coding.net/cjkk/QuestionNaire.git '
Hint:updates were rejected because the remote contains work the
Hint:not has locally. This was usually caused by another repository pushing
Hint:to the same ref. Want to first integrate the remote changes
Hint: (e.g., ' git pull ... ') before pushing again.
Hint:see the ' Note about Fast-forwards ' "Git push--help ' for details.
Git pull https://git.coding.net/cjkk/QuestionNaire.git--allow-unrelated-histories #那个https的地址是自己的coding目录的网址
9: The Last step
git push--set-upstream https://git.coding.net/cjkk/QuestionNaire.git master #同上换下地址
Finally changed the branching problem
It takes three steps to put an elephant in the freezer.
1. Open the refrigerator
Introduce GIT branch view branching State git branch + name Create branch name git checkout + branch name switch to specified branch
Chenjiadembp:questionnaire chenjia$ git Branch
* Master
Chenjiadembp:questionnaire chenjia$ git branch CCC
Chenjiadembp:questionnaire chenjia$ git Branch
Ccc
* Master
Chenjiadembp:questionnaire chenjia$ git checkout CCC
Switched to branch ' CCC '
Chenjiadembp:questionnaire chenjia$ git Branch
* CCC
Master
2: Put the elephant in the current is under the branch, you can do normal additions and deletions to the operation, will not affect the main branch similar to the Linux virtual machine snapshot function and the ancient system backup function
Vim test.txt #创建一个test. txt write something on the inside git add test.txt git commit-m ' Test branch function '
This is done in the branch.
3: The door is not closed to waste electricity when the stage task is completed under the Dev Branch, the master branch is directly cut back and the master branch is pointed to Dev, and Dev can delete the
The git checkout master #切换到master分支git merge Dev #merge合并的意思 merges master and Dev, and the principle is to walk master to dev git branch-d dev #删除分支命令
Over
Git uploads new items to coding