我moodle在我的Github帐户上有一个存储库,我forked来自官方存储库.
然后我在我的本地机器上克隆它.它工作正常.我创建了几个分支(在master分支下).我做了几个提交,它工作正常.
当我这样做时,我不知道我是如何得到以下错误的: git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)
如何在不影响Github上的存储库的情况下解决错误?
我正在使用 Ubuntu 12.10
我.git/config做的内容cat $(git rev-parse --show-toplevel)/.git/config给出了:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "master"]
[branch "MOODLE_23_STABLE"]
[branch "MOODLE_24_STABLE"]
[remote "upstream"]
url = git://git.moodle.org/moodle.git
fetch = +refs/heads/*:refs/remotes/upstream/*
Run Code Online (Sandbox Code Playgroud) 我是最近的git转换器.很高兴能够使用git-svn在不干扰svn服务器的情况下在本地保留我的分支.最新版本的代码中存在一个错误.我想建立一个工作时间,以便我可以使用git bisect.我无法找到正确的命令,以便及时返回.谢谢.
git checkout -b foo切换foo分支(即使它不存在,它被创建),但如果foo分支已经存在,它会抛出这样的错误:
fatal: A branch named 'foo' already exists.
Run Code Online (Sandbox Code Playgroud)
执行以下检查的命令是什么?
git checkout foo)git checkout -b foo)是否有一个Git命令(或一小段命令)可以安全可靠地执行以下操作?
目前我坚持:
git fetch -p
git stash
git stash drop
git checkout $branch
git pull
Run Code Online (Sandbox Code Playgroud)
但它困扰我,因为我要求密码两次(由fetch和pull).通常我会对任何解决方案感到满意,只要密码只需要一次即可.
几个笔记:
我在我的git repo中有一个名为xyz的文件.巧合的是,我还有一个名为xyz的分支.目前我在掌握,但我想结帐分支xyz.要使用的命令很简单
$ git checkout xyz
Run Code Online (Sandbox Code Playgroud)
但这会将文件签出xyz到当前的HEAD.如何将分支更改为分支xyz?
我有一个git存储库.它有ABCDE ...提交.现在我想结帐D作为名为Dbranch的新分支.所以我执行:git checkout D -b Dbranch.现在我想删除这个分支.首先,我需要切换到master分支,然后使用git branch -d Dbranch它来删除它.但是当我执行时git checkout master,它会给我错误.
error: The following untracked working tree files would be overwritten by checkout:
source/a/foo.c
...... (too many lines)
Please move or remove them before you can switch branches.
Aborting
Run Code Online (Sandbox Code Playgroud)
如何删除Dbranch?
如果我这样做git checkout HEAD^,我得到这个:
$ git checkout HEAD^
Note: checking out 'HEAD^'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b …Run Code Online (Sandbox Code Playgroud) 是否可以使用git checkout - 在多个文件上放弃更改?如果是这样,我将如何指定多个文件.谢谢.
昨天,我从一个分支创建了一个分支,将其推送到原点,然后将其合并回 master。你可以在这里看到:
$ history |less
8358 git co master
8359 commit # shortcut that adds all and commits
8360 push # shortcut that `git push`'s
8361 git lg # shortcut that logs my output
8362 git co 1600
8363 git co -b 1601
8364 npm run test
8365 npm run test
8366 npm run test
8367 npm run test
8368 npm run test
8369 npm run test
8370 npm run test
8371 npm run test
8372 npm run test
8373 …Run Code Online (Sandbox Code Playgroud) git ×9
git-checkout ×5
branch ×1
deployment ×1
dvcs ×1
git-branch ×1
git-push ×1
git-svn ×1
github ×1
kiln ×1
mercurial ×1
push ×1
svn ×1
svn-update ×1