Error message here!

Hide Error message here!


Error message here!


Hide Error message here!


Error message here!



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


 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 "username"
  • git config --global "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://'
git config --global https.proxy 'socks5://'
# Setting agent
git config --global http.proxy
git config --global https.proxy

# Check for success
git config --get http.proxy
# 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