我正在使用 perforce 的可视客户端,并且我想从工作区中排除一个目录。在流之前,我只需导航到我的工作区,在树中找到该文件夹,然后将其排除(并且我在发现的许多其他相关问题中找到了此解决方案)。但是,现在我正在使用流,它不会让我这样做,我显然必须编辑流映射。
因此,我尝试在编辑流时将这一行添加到重新映射的框中:
-//NumberPlus/current/Library/... //nplus-mainline/current/Library/
Run Code Online (Sandbox Code Playgroud)
但是我只是收到一个错误:
Error in stream specification.
Error detected at line 24
Null directory (//) not allowed in '-//NumberPlus/current/Library/...'.
Run Code Online (Sandbox Code Playgroud)
编辑:为了澄清,我使用的是 Windows 8.1。
我当时在一个名为 的功能分支中工作auth+menus,下面是我需要帮助尝试恢复的事件和操作的顺序。我担心我会失去所有的工作,我希望我是错的。
git commit -m "code changes"
git commit -m "more changes"
git rebase -i HEAD~2
git checkout master
git pull upstream master
git checkout auth+menus
git rebase master
git rebase --continue存在单一冲突
git rebase --skip
git add --all
git commit -m "some of these files should have already been committed"
git push origin auth+menu
git push origin auth+menu -f因为我是个白痴...
我希望我没有完全失去前两次提交中的所有内容,我真的需要有人的帮助!有没有办法从中恢复并获得我原来的两次提交?
我正在使用 CodeIgniter 创建一个应用程序。项目中任何地方都没有 .git 文件夹,但项目已初始化,因为git status返回以下内容:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: ../../../Vagrantfile
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
这怎么可能?任何地方都没有 .git 文件夹。这是ls -la返回的内容:
total 124
drwxrwxr-x 7 my_username my_username 4096 Mar 7 11:18 .
drwxrwxr-x 8 my_username my_username 4096 Mar …Run Code Online (Sandbox Code Playgroud) 我git在 Windows 上使用,当我使用commit command in the command prompt, my Notepad++ opens up and asks me to put in a commit message as follows:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch is up-to-date with 'origin/master'.
Run Code Online (Sandbox Code Playgroud)
This is great, but I want to be able to separate the message title from its body. When I …
我试图在上游设置 git branch 但低于警告。
git checkout master
git branch --set-upstream-to master
Run Code Online (Sandbox Code Playgroud)
警告:未将分支 master 设置为自己的上游。
我该如何解决?
这是否意味着它已经在跟踪正确的远程分支master?
当然,我使用 git 进行版本控制,它还可以(在一定程度上)使不同的计算机保持同步。现在考虑这种情况:我一直在对我的计算机进行一些重大更改,但我需要离开并想继续使用我的笔记本电脑。但是代码在当前状态下已损坏;它甚至可能无法编译。
如果我独自使用私人存储库工作,我想我可以继续并提交混乱以继续在我的笔记本电脑上工作。不过它确实有一股难闻的气味。
但是,如果我在同一个存储库上与团队合作,那就不行了。一个分支可能会在这里救我,但这仍然像一种解决方法。
我也考虑过使用像 Syncthing 这样的同步应用程序,但我担心两个不同的同步应用程序可能会在某些时候相互咬合。使用 Syncthing 时我不会放弃 git。
我知道这个问题可能不会导致一个正确的答案。但我认为这是程序员可能面临的一个常见场景,并希望关于如何处理它的不同想法将被认为对社区有所帮助。
是否有工具(最好是 linux/ubuntu)可用于浏览在 git 中跟踪的图像(.png,.jpg...)文件的历史记录?
用例:
我知道可以创建一个脚本来提取图像版本并以某种方式将提交消息附加到它,但我正在寻找现有的解决方案但找不到。
我修改了一个函数的参数,现在 git 将它识别为一个全新的代码行。下面的第一行代码代表原来的代码,第二行代表我改变一个参数后的“新”行。第一行最初在第 1 行,新行现在在第 10 行(因为我没有进行原子提交,我相信这是主要问题)。
// on line 1 originally
const myFunction = (someArray: Array<{ id: string; name: string; }>, index: number) => {
// now on line 10
const myFunction = (someArray: Array<{ id: string; name: string; }>, index: string) => {
Run Code Online (Sandbox Code Playgroud)
有什么方法可以告诉 git 第 10 行只是修改了第 1 行,这样看起来不会发生太多的流失?
假设我有 2 个分支 A(旧的)和 B(新的),最近分开了。在 A2 中我犯了一些错误(破坏了我想保留的一些文件的历史记录),我用 B2 修复了这些错误。
我想将分支B的工作目录带到提交A3的状态,但不合并/提交它。相反,我更喜欢只进行(暂存/未暂存)本地更改,以便在下一次提交后,B3 将与 A3 相同(但不以任何方式链接到 A2 或 A3):
A1 - [A2 - A3 - A4] (A will be deleted after the fix)
\
B2 - B3=(state of)A3 - A4
Run Code Online (Sandbox Code Playgroud)
在我的例子中这样做的原因是我搞乱了中间状态A2,我想用B2修复它,然后直接用A3继续。
我想到的最简单的方法是在另一个文件夹中签出 A3,删除 B 的内容并用 A3 的内容覆盖。
有没有Git命令可以直接实现这个功能?
我刚刚在我的OSX Mountain Lion Max(10.8)上安装了Mercurial,在我第一次提交时我收到了错误:
abort: no username supplied (see "hg help config")
Run Code Online (Sandbox Code Playgroud)
我看到了大量的答案,建议我需要在某个位置创建或复制文件并将其粘贴到其他位置,并将我的用户名和电子邮件添加到文档中.
如果这是正确的做法:
我只需要在文件中添加以下两行吗?
[ui]
username = Your Name <your@email.com>
Run Code Online (Sandbox Code Playgroud)谢谢你的帮助.
version-control ×10
git ×8
branch ×3
commit ×1
git-commit ×1
git-rebase ×1
macos ×1
mercurial ×1
merge ×1
notepad++ ×1
perforce ×1