Application examples git scene

Git add multiple remote repository and push to complete

Adding a remote repository

  • git remote add plugin https://gitee.com/iMist/Plugin.git

Note: plugin is the local name specified remote repository

Check whether to add success

  • git remote -v

Check local branch git branch

The local branch of a push to the designated remote repository

  • git push -f plugin dev

NOTE: plugin is the local name of the remote repository, dev is a local branch

Pull branches to the specified remote and local switching

git checkout -b 本地分支名 origin/远程分支名

Delete the specified local or remote branch

  • When our collective project, since the definition branch will push to the main branch master, how to remove custom remote branch it
  1. Use the command git branch -a view all branches

  2. Use the command git push origin --delete Chapater6 can delete a remote branch Chapater6

  3. Again using the command git branch -a can be found in remote branch Chapater6 has been deleted.

Delete the local branch

  • git checkout master First switched to the main branch;
  • git branch -d Chapater8 You can delete the local branch (the main branch)

Git global settings:

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

Create a git repository

mkdir wordpress
cd wordpress
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/iMist/wordpress.git
git push -u origin master

It has been connected to a remote warehouse

cd existing_git_repo
git remote add origin https://gitee.com/iMist/wordpress.git
git push -u origin master

git tag operation

We first need to switch to tag from the branch

Command git tag <tagname> [commit id]is used to create a new label, the default is HEAD, you can also specify a commit id;

Command git tag -a <tagname> -m "blablabla..."can specify the label information;

Command git tagcan view all labels, the label is viewed in alphabetical order not chronologically.

The push remote tag

1.push single tag, command format is: git push origin [tagname]
For example:git push origin v1.0 #将本地v1.0的tag推送到远端服务器

2.push all tag, command format is:git push [origin] --tags

For example:
git push --tags
or
git push origin --tags

If the push fails, make sure the console Git on whether your account has permission to push Tag

Small indeed fortunate

每一丝灵感都值得被记录,每一笔记录都是成长,每一点成长都值得欢呼

Personal bloggers station: www.imisty.cn
CSDN blog: https://blog.csdn.net/lookinthefog
blog Park: https://imist.cnblogs.com/

Hope to know some tech-savvy small partner, welcome to the Friends link yo

Guess you like

Origin www.cnblogs.com/imist/p/11417599.html