git本地与远程分支

已经有远程分支,在本地检出,并且关联到远程分支

  git checkout --trach origin/远程分支名

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

$ git checkout --track origin/dev

$ git checkout -b dev origin/dev

没有远程分支,本地有一个分支,要推送到远程

  git push --set-upstream origin 分支名

  git push -u origin 分支名

git push --set-upstream origin dev

没有远程的时候

  git remote add origin 远程地址

git remote add origin http://xxxxx

删除远程分支

  git push origin :远程分支名

  git push origin --delete 远程分支名

git push origin :dev

远程分支如果被删了,本地和远程分支同步

git remote prune origin

原文地址:https://www.cnblogs.com/413xiaol/p/10659206.html

时间: 2024-08-08 13:33:05

git本地与远程分支的相关文章

Git 在本地添加远程分支的方法

查看本地分支 $ git branch 查看远程分支 加上-a参数可以查看远程分支,远程分支会用红色表示出来(如果你开了颜色支持的话): $ git branch -a master remote tungway v1.52 * zrong remotes/origin/master remotes/origin/tungway remotes/origin/v1.52 remotes/origin/zrong 在本地创建远程分支 $ git checkout -b dev origin/dev

git拉取远程分支并创建本地分支

本地分支推送至远程 git checkout local_branch git push origin local_branch:remote_branch 一.查看远程分支 使用如下Git命令查看所有远程分支: git branch -r 列出本地分支: git branch 删除本地分支: git branch -D BranchName 其中-D也可以是--delete,如: git branch --delete BranchName  删除本地的远程分支: git branch -r

git删除本地及远程分支

1. 删除本地分支: git branch -d branchName 2. 删除远程分支: // 方法一:将删除的本地分支推到远程(要删除的远程分支在本地有映射) git push origin :branchName // 方法二:直接删除远程分支(要删除的远程分支不在本地) git push origin --delete branchName 另: 查看本地分支:git branch; 查看本地及远程所有分支:git branch -a 或 git branch --all 实操:(删除

git本地关联远程项目

git本地关联远程项目: 第一步:选择目录 进入本地需要关联的目录(比如demo目录),然后git init 第二步:关联,origin后面的git地址从git远程复制 git remote add origin [email protected]:yourname/demo.git 第三步:更新 git pull 可能会出现的问题:  如果第二步写错了:则        git remote rm origin   //删除origin        git remote add origin

git 拉取远程分支报错(fatal: '' is not a commit and a branch '' cannot be created from it)

问题描述从远程git上拉取某一个分支,然后报错,拉取不了这个分支. 拉取分支的命令: git checkout -b xxx-static-19 origin/xxx-static-19 其中xxx-static-19是分支名. 报错 fatal: 'origin/xxx-static-19' is not a commit and a branch 'xxx-static-19' cannot be created from it 解决重新拉取数据,git pull ,然后再切回分支 git

git拉取远程分支到本地分支或者创建本地新分支

git fetch origin branchname:branchname 可以把远程某各分支拉去到本地的branchname下,如果没有branchname,则会在本地新建branchname git checkout origin/remoteName -b localName 获取远程分支remoteName 到本地新分支localName,并跳到localName分支

git 查看、创建、删除 本地,远程 分支

1. 查看远程分支 git branch -rorigin/master 2. 查看本地分支 git branch *master 注:以*开头指明现在所在的本地分支 3. 查看本地分支和远程分支 git branch -a*masterremotes/origin/master 4. 创建分支 4-1 创建本地分支 $ git branch test_1 $ git branch -a * master test_1 remotes/origin/master 注:创建本地分支时,默认是把所在

git branch --set-upstream 本地关联远程分支

https://www.jianshu.com/p/403d6ad11e30 最近使用git pull的时候多次碰见下面的情况: There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull <remote> <branch> If you wish t

【转】git命令:删除本地和远程分支

命令行方式 Git Bash: 切换到要操作的项目文件夹 命令行 : $ cd <ProjectPath> 查看项目的分支们(包括本地和远程) 命令行 : $ git branch -a 删除本地分支 命令行 : $ git branch -d <BranchName> 删除远程分支 命令行 : $ git push origin --delete <BranchName> 查看删除后分支们 命令行 : $ git branch -a 其中遇到的问题: bash: sy