Error message here!

Hide Error message here!

忘记密码?

Error message here!

请输入正确邮箱

Hide Error message here!

密码丢失?请输入您的电子邮件地址。您将收到一个重设密码链接。

Error message here!

返回登录

Close

Development Notes: git common command list

Huawei cloud developer community 2021-01-14 14:33:24 阅读数:6 评论数:0 点赞数:0 收藏数:0

Abstract :git It is the most advanced distributed version control system in the world .

Multiplayer collaboration

  • master: This branch is used to publish stable code , Merging is usually done by administrators
  • dev: This branch is for team development , Team members submit code to this branch
  • bug: This branch is used to fix emergency bug, After the repair is completed, it is generally deleted

MASTER Branch

 When dev After testing a version , Merge into master
git merge dev

DEV Branch

Create locally dev Branch , need git push origin dev Sync to remote

git merge dev There is no need for git add Wait for the operation , It's done automatically

Git Default will use Fast forward Pattern , But in this mode , After deleting a branch , Lose branch information , In general, we should use git merge --no-ff -m "merge with no-ff" dev

Other users join DEV

  • Now create it locally , The reason for the error is that it is not associated with the remote code

  • Merger conflict

  • Submitted to the dev

BUG Branch

When we develop in our own branch , One who suddenly received feedback from the project manager bug, But at this point we have cache data in our workspace , Just use git stash

Relevant command

Create and switch branches

  • git checkout -b dev

Switch branches

  • git check dev

View current branch

  • git branch

Delete the branch

  • git branch -d dev

Update project group folder contents

  • git reset --hard

--no-ff git branch -d '' after , stay git log Information can be seen

  • git merge --no-ff -m "merge with no-ff" dev

git pull

  • git pull = git fetch + git merge origin/master

git config

  • git config --global user.name "username"
  • git config --global user.email "email"

git branch -D <name>

  • Drop the branch

git rm -r --cached

  • gitignore The consideration is not comprehensive , When it is found that some documents that should not be submitted have been submitted , Use this command

The problem record

  • error: cannot open .git/FETCH_HEAD: Permission denied
# No permission granted , stay post-receive An association operation is generated in , So report a mistake
chown -R git:git /data/wwwroot/deploy/tools/
# The company intranet needs to be set up
# Set up ss
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
# Setting agent
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

# Check for success
git config --get http.proxy
172.17.18.80:8080
# Cancel the agency
git config --global --unset http.proxy
git config --global --unset https.proxy
This article is shared from Huawei cloud community 《Git Common commands and multi-user related operations 》, Original author :CodeStack.

 

Click to follow , The first time to learn about Huawei's new cloud technology ~

Copyright statement
In this paper,the author:[Huawei cloud developer community],Reprint please bring the original link, thank you