1.查看本地分支:
git branch;查看远程分支: git branch -r ;查看所有分支: git branch -a
2.删除分支:
删除本地分支git branch -D dev(分支名字); 删除远程分支git checkout -b dev git branch --set-upstream dev origin/dev
3.新建分支git如何新建分支
1) 切换到基础分支,如主干 git checkout master 2)创建并切换到新分支 git checkout -b panda git branch可以看到已经在panda分支上 3)更新分支代码并提交 git add * git commit -m "init panda" git push origin panda 4)在git代码管理界面经可以看到panda分支了,成功~~ git config user.name git config user.email git config --global user.password 'lzl@155155' 删除git yum -y remove git 安装git yum -y install git 查看版本 git --version # 查看用户名和邮箱地址 git config user.name git config user.email # 修改用户名和邮箱地址 git config --global user.name "username" git config --global user.email "email" git config --global user.password '****' 配置文件所在的位置: /etc/gitconfig # 系统级别的配置 ~/.gitconfig # 当前用户级别的配置 git config --global 来进行修改 .git/config # git 仓库级别的配置 设置远程跟踪分支 git push -u origin your-branch-name
---------------------------
git add 加入缓存区(git add * 添加所有) git reset 取消已经缓存区的文件 git restore 取消文件当前修改的信息 git diff 查看本地的更改信息 git diff --cached 查看缓存区文件的修改信息 git status 查看本地改动的文件(新增文件) git stash 把修改储藏起来 git stash apply 把储藏返回出来 --------------------- git fetch origin liziliang:0623 拉远程指定分支liziliang到本地新建分支0623
---------------------------
These are common Git commands used in various situations: start a working area (see also: git help tutorial) clone Clone a repository into a new directory init Create an empty Git repository or reinitialize an existing one work on the current change (see also: git help everyday) add Add file contents to the index mv Move or rename a file, a directory, or a symlink restore Restore working tree files rm Remove files from the working tree and from the index examine the history and state (see also: git help revisions) bisect Use binary search to find the commit that introduced a bug diff Show changes between commits, commit and working tree, etc grep Print lines matching a pattern log Show commit logs show Show various types of objects status Show the working tree status grow, mark and tweak your common history branch List, create, or delete branches commit Record changes to the repository merge Join two or more development histories together rebase Reapply commits on top of another base tip reset Reset current HEAD to the specified state switch Switch branches tag Create, list, delete or verify a tag object signed with GPG collaborate (see also: git help workflows) fetch Download objects and refs from another repository pull Fetch from and integrate with another repository or a local branch push Update remote refs along with associated objects 'git help -a' and 'git help -g' list available subcommands and some concept guides. See 'git help <command>' or 'git help <concept>' to read about a specific subcommand or concept. See 'git help git' for an overview of the system.