Git uses advanced

Time:2022-4-24

preface

With the widespread use of GIT, we need to pay more attention to the standard process of use, which is recorded here.

catalogue

  • Beautiful Badge
  • Better pull
  • Configure agent and cancel agent
  • The rebase command modifies the commit commit history
  • Ignore files when git merge

Beautiful Badge

Continuous integration

Git uses advanced

npm

custom

You can customize and modify the label text on the left and the color on the right

other

Git uses advanced Git uses advanced

Better pull

cause

Git uses advanced

Git uses advanced

git pull origin xxx --rebase

#Execute pull directly as rebase
git config --global pull.rebase true

Using rebase makes it feel like everyone is developing on the same straight line. A very clean log looks very comfortable, while using pull log directly looks very messy.

git pull –rebase

*| b9feea8 - chore: add C to go to a burial point (6 hours ago) < yanyue404 >
* | b3047fe - fix: ISO8601 time (6 hours ago) <yanyue404>
*| bfb6c84 - Test: formattimestr compatible with IOS (7 hours ago) < yanyue404 >
*| 0e13196 - chore: IOS time processing (22 hours ago) < yanyue404 >
*| f15a0e8 - chore: tourists authorize on the business card page (24 hours ago) < yanyue404 >
*| ee8b125 - chore: perfect personal business card (25 hours ago) < yanyue404 >
*| deb7a5a - chore: add user role verification to personal business card (26 hours ago) < yanyue404 >
*| 5106b02 - chore: start identifying user roles (27 hours ago) < yanyue404 >
*| f16b6af - chore: replace appid (31 hours ago) < yanyue404 >
*| 7216da4 - chore: sync code (31 hours ago) < yanyue404 >
*| 9e542b4 - chore: UAT update (6 days ago) < yanyue404 >
*| 473e311 - fix: modify environment (6 days ago) < yanyue404 >
*| f54ae0f - chore: buried point (5 hours ago) < yanyue404 >

git pull

*| ae57454 - feat: mandatory recertification of expired token (2 days ago) < yanyue404 >
* |   1b02194 - Merge remote-tracking branch 'origin/prod' into prod (2 days ago) <Joe>
|\ \
|* | 6284b85 - fix: login process short video playback (2 days ago) < yanyue404 >
|* | 2bcb162 - styles: Canvas share map location optimization (2 days ago) < yanyue404 >
|* | d4c66a6 - chore: page sharing control (2 days ago) < yanyue404 >
|* | 91baa28 - chore: personal business card non franchisee text modification (2 days ago) < yanyue404 >
*|| 60715e9 - modify policy judgment (2 days ago) < Joe >
|/ /
* |   85f1032 - Merge remote-tracking branch 'origin/prod' into prod (2 days ago) <Joe>
|\ \
|* | ab884df - feat: personal business card sharing page authorization (4 days ago) < yanyue404 >
*|| e603434 - optimized loading speed (2 days ago) < Joe >
|/ /
*| a255e59 - fine tune style comment line feed (4 days ago) < Joe >
* |   7251630 - Merge remote-tracking branch 'origin/prod' into prod (4 days ago) <Joe>
|\ \
|* | 1bd08fc - chore: loading optimization (4 days ago) < yanyue404 >
*|| 7bc0e9e - modify video list problem (4 days ago) < Joe >
|/ /
* | 9e328af - 1. Cancel my video and change my personal business card (4 days ago) < Joe >

Configure agent and cancel agent

Error: Filed to connecto to github.com port 443: Time out

#Set
git config --global http.proxy http://127.0.0.1:51349

#Cancel
git config --global --unset http.proxy

The rebase command modifies the commit commit history

Merging recently submitted history willba4358dreacha549037Become a commit

#Input
git log --online

#Output
Ba4358d (head - > master, origin / master, origin / head) docs:
ba4358d Update README.md
ba4358d Update README. MD # this entry is merged into one
36f95d9 docs
0312afb init

Prepare to merge

git rebase -i 36f95d9 | git rebase -i HEAD~3

Select merge

#Output

Pick ba4358d 'notes

Pick ba4358d 'notes

Pick ba4358d 'notes

#Pick means to be able to execute the commit
#Squash means that this commit will be merged into the previous commit (omitting the writing method s)
#Enter I under the VIM command to enter the editing mode. After editing, EQ saves and exits

#Input

Pick 3ca6ec3 'notes **********************************************************

S 1b40566 'note ********************************************************

S 53f244a 'comment *************************************************************************

After saving, you have two choices

Git rebase -- continue # confirm rebase
Git rebase -- abort # cancel rebase

#After confirmation, it can be uploaded to the remote.

If there is no conflict or the conflict has been resolved, the following editing window will appear, enter:wqSave and roll out:

# This is a combination of 4 commits.
#The first commit’s message is:
notes......
# The 2nd commit’s message is:
notes......
# The 3rd commit’s message is:
notes......
# Please enter the commit message for your changes. Lines starting # with ‘#’ will be ignored, and an empty message aborts the commit.

Look at the history, it has changed

git log --oneline
d2d71a5 (HEAD -> master) Update README.md
36f95d9 docs
0312afb init
Git push - F # force overwrite remote
Git commit -- amend - M "new comment" # modify the latest git commit comment

Ignore files when git merge

remind: the master can only ignore files on other branches when merging other branches. The master cannot ignore files on the master when merging other branches (Master is the default primary branch)

  1. Create a custom merge driver
git config --global merge.ours.driver true
  1. Create on the branch to be merged Gitattributes file, and do not set the file name of merge in the file
project.config.json merge=ours
fetch.js merge=ours
app.js merge=ours
  1. Go back to the branch master to be merged and execute merge:
git merge uat

stayuatOn branchproject.config.jsonfetch.jsapp.jsIt won’t be merged!

Reference link

  • Git uses a standardized process, by Ruan Yifeng
  • Git remote operation details, by Ruan Yifeng
  • Understanding the GitHub flow
  • Learn git branching / netizen response
  • https://stackoverflow.com/que…
  • Addition and setting of GitHub project Badge
  • https://shields.io/

Recommended Today

php displays Chinese graphically and specifies the ttf font library

1 <?php 2 header("Content-Type:image/png"); 3 $img=imagecreatetruecolor(400,300); 4 // imagejpeg($img); 5 // imagejpeg($img,"./img/copy_img01.jpg",10); 6 $color1=imagecolorallocate($img,100,100,100); 7 $color2=imagecolorallocate($img,255,0,0); 8 $str="北京欢迎你!"; 9 imagefill($img,0,0,$color1); 10 // imagestring($img,5,0,0,$str,$color2); 11 $fontfile="F:\phpStudy\WWW\myweb\FZXBSJW.ttf"; 12 imagettftext($img,24,0,100,100,$color2,$fontfile,$str); 13 imagepng($img); 14 imagedestroy($img); 15 // header("Content-Type:text/html"); 16 // echo "gave over!"; Line 13 imagepng($img) must have, and the Chinese font path must be an absolute path.