我希望我的本地和远程存储库在分支方面始终保持同步.
在GitHub上进行Pull Request审核后,我合并并删除了我的分支(远程).我如何在本地存储库中获取此信息并让Git删除我的本地版本的分支?
我正在移动构建过程以使用mercurial并希望将工作目录恢复到最新修订的状态.早期的构建过程运行将修改一些文件并添加一些我不想提交的文件,因此我有本地更改和未添加到存储库的文件.
什么是丢弃所有这些并获得具有最新版本的干净工作目录的最简单方法?
目前我这样做:
hg revert --all
<build command here to delete the contents of the working directory, except the .hg folder.>
hg pull
hg update -r MY_BRANCH
Run Code Online (Sandbox Code Playgroud)
但似乎应该有一个更简单的方法.
我想做的相当于删除repo,进行新的克隆和更新.但是回购太大了,不够快.
我得到这个错误拉:
您的配置指定从遥控器与ref'refs/heads/feature/Sprint4/ABC-123-Branch'合并,但没有提取此类参考.
任何其他分支都不会出现此错误.
关于这个分支的特殊之处在于它是从另一个分支的先前提交创建的.
我的配置文件如下:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = <url here>
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "new-develop"]
remote = origin
merge = refs/heads/new-develop
[branch "feature/Sprint4/ABC-123-Branch"]
remote = origin
merge = refs/heads/feature/Sprint4/ABC-123-Branch
Run Code Online (Sandbox Code Playgroud) 我已经开始与一些项目的朋友合作,他们使用heroku git存储库.
我几天前克隆了存储库,他们已经做了一些更改,所以我试图获取最新的更新
我运行了git pull --rebase这里所说的命令(这是正确的方法吗?):https://devcenter.heroku.com/articles/sharing#merging-code-changes
我收到以下错误:
$ git pull --rebase
Cannot pull with rebase: You have unstaged changes.
Please commit or stash them.
Run Code Online (Sandbox Code Playgroud)
我的猜测是我搞乱了代码,现在它要么我要么提交要么丢弃(存储意味着什么?)这些变化.这是发生了什么?如果是这种情况,我想放弃我可能做出的任何更改,只是从git存储库中获取更新的代码.
知道我能做什么吗?
我在GKE上的Kubernetes中有以下复制控制器:
apiVersion: v1
kind: ReplicationController
metadata:
name: myapp
labels:
app: myapp
spec:
replicas: 2
selector:
app: myapp
deployment: initial
template:
metadata:
labels:
app: myapp
deployment: initial
spec:
containers:
- name: myapp
image: myregistry.com/myapp:5c3dda6b
ports:
- containerPort: 80
imagePullPolicy: Always
imagePullSecrets:
- name: myregistry.com-registry-key
Run Code Online (Sandbox Code Playgroud)
现在,如果我说
kubectl rolling-update myapp --image=us.gcr.io/project-107012/myapp:5c3dda6b
Run Code Online (Sandbox Code Playgroud)
执行滚动更新,但没有重新拉动.为什么?
git pull我正在尝试使用 Android Studio 的内置按钮执行,但失败并显示以下消息:
Git Pull Failed
Invocation failed Unexpected end of file from server
java.lang.RuntimeException: Invocation failed Unexpected end of file from server
at org.jetbrains.git4idea.http.GitAskPassXmlRpcClient.askUsername(GitAskPassXmlRpcClient.java:55)
at org.jetbrains.git4idea.http.GitAskPassApp.main(GitAskPassApp.java:66)
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:848)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at org.apache.xmlrpc.DefaultXmlRpcTransport.sendXmlRpc(DefaultXmlRpcTransport.java:87)
at org.apache.xmlrpc.XmlRpcClientWorker.execu... (show balloon)
Run Code Online (Sandbox Code Playgroud)
这可能失败的原因是什么?
我有一个工作副本存储库,我一直在工作没有问题; 此存储库的原点位于GitHub上.
我想让我的工作副本存储库可用作我的构建机器(另一个物理主机上的VM)的原点,因此我可以在构建机器上构建和测试我对工作副本的提交,而无需通过首先是GitHub.我已经有了GitHub存储库的构建,但我希望这是一个"黄金"存储库/构建; 即,如果有东西进入那里,应该保证对GitHub的构建通过.
我查看了有关Git URL的文档,并看到可以选择在表单中使用URL git://host.xz[:port]/path/to/repo.git/(例如,参见git-clone文档).我希望以最简单的方式执行此操作,只需最少的配置:我不希望设置SSH守护程序或Web服务器只是为了将其发布到我的构建计算机.
我正在运行Windows 7 x64 RC,我安装了MSysGit和TortoiseGit,并且我在防火墙上打开了Git的默认端口(9814).请假设工作副本仓库位于D:\Visual Studio Projects\MyGitRepo,主机名为devbox.构建计算机是Windows Server 2008 x64.我一直在构建机器上尝试以下命令,并带有相关的输出:
D:\Integration>git clone "git://devbox/D:\Visual Studio Projects\MyGitRepo"
Initialized empty Git repository in D:/Integration/MyGitRepo/.git/
devbox[0: 192.168.0.2]: errno=No error
fatal: unable to connect a socket (No error)
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
我正在使用Git子树和我正在处理的几个项目,以便在它们之间共享一些基本代码.基本代码经常更新,升级可以在任何项目中进行,最终所有项目都会更新.
我遇到了一个问题,git报告我的子树是最新的,但是推送被拒绝了.例如:
#! git subtree pull --prefix=public/shared project-shared master
From github.com:****
* branch master -> FETCH_HEAD
Already up-to-date.
Run Code Online (Sandbox Code Playgroud)
如果我推,我应该得到一个消息,没有什么可以推动......对吗?对?:(
#! git subtree push --prefix=public/shared project-shared master
git push using: project-shared master
To git@github.com:***
! [rejected] 72a6157733c4e0bf22f72b443e4ad3be0bc555ce -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:***'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about …Run Code Online (Sandbox Code Playgroud) 采取这种情况:
获得这些选择的更改量的最有效方法是什么,合并到我的'fork'中?
我有一个关于Git的新手问题:
我需要在分支的历史中来回移动.这意味着,我需要将所有文件放到一些旧版本中的状态,然后我需要回到存储库中的最新状态.我不需要提交.
使用SVN,它会
svn up -r800
Run Code Online (Sandbox Code Playgroud)
得到修订版800,和
svn up
Run Code Online (Sandbox Code Playgroud)
与存储库保持同步.
我知道我想要回复的提交的哈希,所以我试过了
git reset <hash>
Run Code Online (Sandbox Code Playgroud)
这似乎让我在那里.但后来我试过了
git pull
Run Code Online (Sandbox Code Playgroud)
但是抱怨冲突.
那么,通过分支历史的正确方法是什么?
我正在考虑SVN,所以不要指向我一些很好的教程.请注意,我已经检查了http://git.or.cz/course/svn.html和http://www.youtube.com/watch?v=8dhZ9BXQgc4.
谢谢,Ondra.
pull ×10
git ×8
branch ×2
git-pull ×2
bitbucket ×1
git-subtree ×1
github ×1
heroku ×1
image ×1
kubernetes ×1
mercurial ×1
merge ×1
push ×1
repository ×1
reset ×1
tortoisegit ×1
working-copy ×1