2023.7 ---- git basic operation + git usage in vs code

 A team uses:


Team leader:
1. Create a warehouse
2.git init
3.git add origin master
4.git commit -m '[team leader] submit'
5.git push origin master
6. Open source the warehouse, invite team members, and distribute the warehouse website To team members and assign tasks

Team members:
1. Clone the project: git clone https://gitee.com/. . . . /test.git
2. Development and completion of tasks
3.git add .
4.git commit -m '[team member xxx] submit'
5.git pull origin master (update the submitted content to prevent direct overwriting!!!)
6.git push origin master

The final experience is: Isn't it faster to click submit and upload directly on vsCode? Well, this is just one of the upload methods, just understand.

So enter the project group to pull the code

Step 1: Configuration

git config --global user.name  "spinkh"
git config --global user.email "[email protected]"
1.设置
修改用户名 git config --global user.name "xxxx(新的用户名)"

修改密码 git config --global user.password "xxxx(新的密码)"

修改邮箱 git config --global user.email "[email protected](新的邮箱)"

2.查看
1)通过命令查看

查看用户名 :git config user.name

查看密码: git config user.password

查看邮箱:git config user.email

查看配置信息(包含用户名和密码): $ git config --list

Step 2: Pull the code 

Two vscode uses its own git

Look first: Git usage in VSCode_vscode git_Xijing Swordsman's Blog-CSDN Blog

1 initialization

 Equivalent to git init

1 Pull code from remote repository

Directly choose to clone the repository, enter your warehouse address, and press Enter to select the location to be stored!

insert image description here

If the code has been pulled through the command line, it can be directly imported into the project

2 Add delete and modify flag

3 add (add)

After u has been added, the state is changed to a (untracked state-----"temporary storage area)

3.2 Unstage storage: 

3.3 You can operate on a single file or on all files

 3.4 Check what has been changed:

click file

4 submit

5 Create a branch

 Enter a name for the new branch. will jump directly to the new branch

or:

 

6 Modify the file in the new branch and view the difference

 7 switch branches

 Note: To select a local branch, not a remote branch

8 Merge branches

Switch to the main branch first, then merge the new branch

There may be conflicts when merging, resolve conflicts, and submit through add, commit push

9 push

10 After modification, click the button directly

11 Resolving Conflicts

5. Resolve conflicts through commit_哔哩哔哩_bilibili

4. Use stash to temporarily store: restore changes to resolve conflicts_哔哩哔哩_bilibili

Notice:

commit to resolve conflicts. If you choose to adopt the current modification, you will not be able to submit it. It needs to be different from the current one. Refer to

5. Resolve conflicts through commit_哔哩哔哩_bilibili

So use the command line:

My project is to keep my modification, so click Accept Current Change, after all processing, re-run the following command to upload successfully.

git add ./*
git commit -m"optimize xxx"
git push -u origin master

解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists).

Solve Git error: error: You have not concluded your merge (MERGE_HEAD exists)._Others_Big Data Knowledge Base

Three vscode view git submission (commit) records

insert image description here

Vscode checks the git submission (commit) record, and updates the content of the current branch, temporarily stores the local library, and submits the remote library_vscode checks the git submission record_?abc!'s blog-CSDN blog

Error: vscode error net::ERR_INVALID_ARGUMENT

vscode error net::ERR_INVALID_ARGUMENT

Four git basic commands

Git workflow and core principles | GitHub basic operations | Using Git and associated GitHub in VS Code_哔哩哔哩_bilibili

initialization:

git config --global user.name  "spinkh"
git config --global user.email "[email protected]"

submit:

View the commit version: 

ignore file: 

Create a branch:

 

 Create and switch branches

Merge branch:

 

To resolve conflicts:

go back

How does Git achieve version rollback? Git rolls back to the previous version.

Guess you like

Origin blog.csdn.net/qq_38210427/article/details/131787717