Git practical command record

Since the last time wrote a Git entry- related blog, has been thinking that he can fully grasp Git, it is not true today, a guy asked me how to delete a remote branch above, uh, no.

git branch -d only delete the name of the local branch of a branch, remote branch delete command

git push origin --delete 分支名

I remember a friend asked me, you give me the code on this address how downloaded ah, I put my last blog post pushed to him, and he looked a long time, you have to write what I see as long as your code on it, you teach me how to download it, in fact, he wanted nothing more in fact a command

git clone https://gitee.com/sanri/web-ui.git

He said it was not and the link https, each time with a user name and password, etc., or let it use to configure ssh-free dense connections, new to who can understand what you are saying, though your experience may be useful.

May sometimes feel that you remember more commands are not as understanding more profound, like the Bowen said.

In this paper I want to balance my two perspectives, the necessary orders still have to be, and if you can make use of tools to achieve the aid of tools to achieve, but some command tool can not be achieved, we need to remember themselves.

Some online common commands, but does not mention a practical command history, will continue to update this article in csdn, other sources do not provide updates, please go to my blog to see the latest recording

Direct clone a branch, rather than the default master branch clone

git clone -b 分支名 地址

Switch to local branch and a remote branch

# 切换本地分支 
git checkout 分支名
# 切换远程分支(这时远程分支代码并未下载下来)
git checkout -b 分支名

# 切换分支后,再拉取远程分支代码
git pull origin dev 

Delete remote branch

git push origin --delete 分支名

Update the list of remote branches, sometimes at the interface management tool to create a branch, but needs to be updated in order to know the local remote branch information

git remote update origin -p 

View remote branches, local branches, all branches

git branch -r 
git branch 
git branch -a 

Part of the file to merge a branch of the current branch, and sometimes do not want to merge all, use git checkout can be resolved

git checkout 分支名 --filename 

If you want to merge multiple files, you can use shell scripts

Little promotion

Writing is not easy, I hope the support of open source software, and my gadgets, welcome to gitee point star, fork, put bug.

Excel common import and export, support Excel formulas
blog address: https://blog.csdn.net/sanri1993/article/details/100601578
gitee: https://gitee.com/sanri/sanri-excel-poi

Use the template code, the gadget generate code from the database, and some projects can often be used in the
blog address: https://blog.csdn.net/sanri1993/article/details/98664034
gitee: https://gitee.com/ sanri / sanri-tools-maven

Guess you like

Origin www.cnblogs.com/sanri1993/p/11979332.html