标签: git-remote

即使删除了其上游远程分支,git remote prune origin也不会删除本地分支

这是一个常见的用例,我克隆一个存储库,签出一个分支,做一些代码更改,进行多次提交,然后当它稳定时,我做一个推送到远程,最终分支被合并和删除.我离开了一个上游的当地分支机构.

我一直在寻找一种删除所有这些分支的安全方法.从描述来看,似乎git remote prune起源正是这样做的.但它似乎并不适合我.

看到以下行为,分支encrdb_init已被删除remotegit remote prune origin命令似乎没有修剪它.我不知道为什么.

$ git branch
  bugfix/encrdb_init
  * master
$
$ git remote prune origin
$
$ git checkout bugfix/encrdb_init
  Switched to branch 'bugfix/encrdb_init'
  Your branch is based on 'origin/bugfix/encrdb_init', but the upstream 
  is gone.
  (use "git branch --unset-upstream" to fixup)
$
$ git branch
  bugfix/encrdb_init <<< shouldn't this have been pruned?
  * master
Run Code Online (Sandbox Code Playgroud)

供参考添加输出 git remote show origin

$ git remote show origin
* remote origin
  Fetch URL: …
Run Code Online (Sandbox Code Playgroud)

git git-remote git-branch

13
推荐指数
1
解决办法
7425
查看次数

无法同时创建本地和远程分支(跟踪)

来自Pro Git:

如果您愿意,可以设置其他跟踪分支 - 不跟踪原点分支并且不跟踪主分支的分支.简单的例子是你刚才看到的例子,运行git checkout -b [branch] [remotename]/[branch]

$ git checkout --track origin/serverfix分支serverfix设置为跟踪远程分支refs/remotes/origin/serverfix.切换到新分支"serverfix"

$ git checkout -b sf origin/serverfix Branch sf设置为跟踪远程分支refs/remotes/origin/serverfix.切换到新的分支"sf"

我的理解是,这提供了一种创建本地分支和上游分支的方法.

但当我这样做时:

git checkout -b iss53 origin/iss53 我明白了:
fatal: Cannot update paths and switch to branch 'iss53' at the same time.

当我这样做时:
git checkout --track origin/iss53 我得到:

致命:无法同时更新路径并切换到分支'iss53'.您是否打算签出无法解决为提交的'origin/iss53'?

为什么?

git version-control git-remote git-branch

12
推荐指数
1
解决办法
1万
查看次数

Git - 将dist文件夹部署到不同的远程

我正试图找出一种方法,dist使用Git 将文件夹部署到不同的远程仓库.

工作项目存储在一个app文件夹中.我使用grunt优化并将工作项目编译到一个dist文件夹中.我想知道是否有一种方法可以使用git将dist文件夹仅推送到与项目其余部分使用的原点不同的远程文件夹.

显然,我只需要dist文件夹即可上线.不是整个项目.

我试着调查Git Subtree - 但我不确定我是否理解这个概念,或者我是否可以用它来完成我想要做的事情.

任何建议都会非常有帮助!

提前致谢!

丰富

git deployment git-remote git-subtree

12
推荐指数
2
解决办法
7037
查看次数

AWS CodeCommit 与 git-remote-codecommit

我使用 Windows 并尝试使用 git-remote-codecommit。

使用 git-remote-codecommit HTTPS 连接到 AWS CodeCommit 的步骤。

https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-git-remote-codecommit.html

获取时,此错误显示:

git clone codecommit://MyRepositoryName

git: 'remote-codecommit' is not a git command. See 'git --help'
Run Code Online (Sandbox Code Playgroud)

请帮忙..

amazon-web-services git-remote aws-codecommit

12
推荐指数
2
解决办法
3万
查看次数

如何用EGit创建一个新的远程分支?

假设我有一个Eclipse项目,它使用EGit进行版本控制,并与远程存储库连接git@myrepo.com:git2013.在我的项目中,在本地分支下newstuff,我创建并更改了一些文件.现在,我想将其推送到newstuff我的远程存储库中命名的远程分支.但我的远程存储库只有一个分支master.

如何创建一个名为的新远程分支newstuff

PS:请不要用命令行git命令回答; 描述如何在EGit中完成它.

branch git-remote egit

11
推荐指数
2
解决办法
2万
查看次数

如何使用GitKraken多个遥控器

我经常使用GitKraken,但我无法管理如何设置我想要推送的遥控器.在上下文菜单中,我找不到任何条目,如"使用此遥控器进行推/拉".

我必须通过命令行设置它,然后它按预期工作.

git push -u origin2 dev/mybranch

这真的是一个缺失的功能吗?

git git-remote gitkraken

11
推荐指数
2
解决办法
4106
查看次数

如何在 Visual Studio Code 中推送 Git 标签?

有谁知道如何使用 Visual Studio Code 将创建的标签推送到远程存储库?

git git-remote git-tag visual-studio-code

11
推荐指数
1
解决办法
6781
查看次数

Forcing Remote Repo to Compress (GC) with Git

I'm using Git to version a series of binary files. They compress pretty well, but my central repos do not seem to be compressing when I push to them. They're eating up a decent amount of my quota, so I was looking to see if there was a way to force the remote repo to do a GC.

Is this possible? I'm working on Project Locker so I don't believe I have SSH access to go in and GC the …

git git-remote git-gc

10
推荐指数
1
解决办法
9865
查看次数

git:禁用自动推送到某个远程分支

当我运行时git push,我的本地分支some_branch被推送到远程分支some_remote\some_branch.

当我跑步时,git remote show some_remote我得到:

Local refs configured for 'git push':
[cut]
some_branch         pushes to some_branch
Run Code Online (Sandbox Code Playgroud)

我不想要这个.如何删除此条目?

git git-push git-remote

10
推荐指数
1
解决办法
3727
查看次数

远程:Mac 终端中未找到存储库错误

我是 git 新手。我有一个私人存储库,现在我想将本地存储库的更改推送到远程存储库。但是,我收到错误:

remote: Repository not found.
fatal: repository 'https://github.com/co-csp/csm.git/' not found
Run Code Online (Sandbox Code Playgroud)

可能会导致这些错误的原因是什么,请帮我解决它,我使用的是Mac 终端。我的github 配置文件中的用户名是john2git config user.namegit config user.username两者都给出john2,所以用户名似乎是正确的......

git github git-push git-remote

10
推荐指数
2
解决办法
3万
查看次数