Git learning: Git download project and submit code

1. Create a new directory to store the downloaded items. I created a "crm" folder on the D drive to store the downloaded items.
Insert picture description here
2. Enter the newly created folder, that is, enter "crm" and click the right mouse button , Select "Git Bash Here", as shown below: After
Insert picture description here
clicking "Git Bash Here", you can see the following interface, otherwise, there may be a problem with your Git Bash installation.
Insert picture description here
3. Perform basic configuration as the basic configuration of git. Tell git who you are and the information you enter will appear in the commit you created, use the following two commands:

git config --global user.name "Your name or nickname"

git config --global user.email "your mailbox"
 Insert picture description here
4. Execute the following command in the gitspace folder to complete the initialization

  git init

  git remote add origin <你的项目地址> //注:项目地址形式为:https://gitee.com/xxx/xxx.git或者 [email protected]:xxx/xxx.git

Insert picture description here
5. If you want to clone, just execute the command

 git clone <项目地址>

6. Enter the directory of your initialized or cloned project, and then execute:

从服务器下更新项目,因为已经clone过,所以不需要再更新

git pull origin master 

7. Make some modifications, such as adding a "description.txt" file.
Execute the following command to complete the first submission

  git add .

  git commit -m “安装教程测试”

  git push origin master  

Note: There are two submission commands, git push origin master (normal submission) and git push origin master -f (mandatory submission, forced submission may change the previous commit comment information and will not change the modified code, use it with caution), both Other common git commands submitted to the master branch

View all branches: git branch -a

Switch to a branch: git checkout branch name

Merged branch: git merge original branch target branch

Insert picture description here

git config --global user.name "l"
git config --global user.email "[email protected]"
git init
git remote add origin http://192.192.192.192/njava/visit
git pull origin master

Guess you like

Origin blog.csdn.net/weixin_41812784/article/details/108595660