Learn Pull request

I received guidance and help from my mentor Xing Fan, used ChatGPT provided by my mentor chunlong Li, searched on Baidu, and learned some information. Much of the following content was written by my mentor Xing Fan. Thank you Xing Fan. Considering privacy, it is not suitable to make screenshots public.

first step:

Open Git Bash Here

If there is a blank folder, git init.

Step two:

Establish contact with the remote warehouse.

git clone <git repo url>

If you already have a local warehouse, you can omit the remote warehouse to establish contact.

third step:

Switch branches as follows:

git checkout <your git branch name>

Local branch name chosen by yourself

I learned git checkout -b xxxxx, and I can change the branch name at will locally.


To switch branches, just use git checkout <branch_name>. Add -b to create a branch.

Create a new branch as follows:

git checkout -b <new-branch>

View all remote branches git branch -r.

the fourth step:

git add <filename>

git commit -m "name"

I haven't tried the following.

git stash

git pulll origin <remote branch name>

git stash pop

the fifth step:

Determine the branch name to be pulled

Check it on the Github page

git fetch origin <remote branch>

Pull other people's branches

git pull origin <git branch name you want to sync with>.

Step 6:

After debugging and modification, git add <paths of files you want to commit>

Step 7:

git commit -m "<commit info you want to attached to your commit>"

Step 8:

git merge <remote branch name>

Step 9:

git push (the first time you need to set up a remote branch, there will be a prompt in the terminal: git push --set-upstream origin <branch name>)

git push -u origin branch name

The general process is
1. Clone to the local
2. Create your own branch locally
3. Pull the latest code of the main branch
4. Local development and debugging
5. Commit & push the local code to the remote end
6. Use your own branch to initiate a pull request application Merge to main branch
7. Other people’s code review ends with approve pr
8. Merge to main branch

1. git clone <git repo url>
2. git checkout -b <your git branch name> (I put all my branches under the xingfan folder, so it is called xingfan/header. You can put it under your own name. folder)
3. git pull origin <git branch name you want to sync with> such as git pull origin main, or git pull origin xingfan/header
4. After debugging and modification, git add <paths of files you want to commit>
5 . git commit -m "<commit info you want to attached to your commit>"
6. git push (The first time you need to set up the remote branch, there will be a prompt in the terminal: git push --set-upstream origin <branch name> )

Guess you like

Origin blog.csdn.net/DXB2021/article/details/132166472