场景:我们遵循git工作流:
母版分支-有来自各个特性分支的可发布代码
to - be -QAd分支有来自各个特性分支的代码,这些代码还有待QA测试。
我创建了一个分支1)Made特性--一个来自于提交的少数更改的分支(提交1)Made,更多的更改和提交(提交2)Merged分支功能-A in to to -be-QAd<code>E 223</code> branchRealized )该特性不像<code>E 126<//code>to-be-QAd</code>E 227</code> branchSwitche
mohamed@mohamed:~/Projects/skyrocket$ git status
On branch dev/SMMWEB-36
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: config/puppet
你好,我想撤消我的最后一次提交。我所做的是我对文件做了一些更改,然后提交它们,但我还没有将它们推送到主存储库。在执行git commit -m "comment“命令后,我运行了git status,并收到以下消息
Your branch is ahead of 'origin/demo' by 1 commit
所以现在我想要撤销我的最后一次提交,那么我该怎么做呢?
在搜索git保存存储提交的位置时,我注意到了.git/log。认定:
$ ls .git/logs/
HEAD refs
$ diff .git/refs/ .git/logs/refs/ | head -n3
Common subdirectories: .git/refs/heads and .git/logs/refs/heads
Common subdirectories: .git/refs/remotes and .git/logs/refs/remotes
diff .git/refs/stash .git/logs/refs/stash
意思是stash -是logs
我删除了特定分支的本地分支和远程分支。
git branch -d branchName
git branch --delete --remotes origin/branchName
当我签出一个不同的分支时,在运行git status时仍然会看到未跟踪/未提交的文件。
这些文件没有任何更改,我想保留,或阶段或提交。当我在不同的分支上运行git status时,我不想看到他们坐在这个区域
Changes not staged for commit:
(use "git add <file>..." to update what will be committe
我很困惑,我想我已经失去了几个小时的工作。
我之前在Git中编辑了一个文件,我保存了它,但没有提交。我确实做了一些其他的文件更改,并提交和推送它们。但是,有一个文件被搞乱了,所以我单击了最后一次成功的提交,并按下了"roll to this commit“。令我恐惧的是,它删除了我所有未提交的更改,现在我不知道如何找回它们,因为它们没有提交。
我正在尝试使用扩展来提交到我的gh分支。它在本地工作很好,但是当我使用TRAVIS-CI时,它失败了。它提供了以下错误信息-
Warning: fatal: remote error:
You can't push to git://github.com/tusharmath/tusharm.com.git
Use https://github.com/tusharmath/tusharm.com.git
Use --force to continue.
当我更新回购选项时,我会得到以下错误-
Warning: remote: Anonymous access to tus
我做了git status,看到了一堆新文件,例如:
要提交的更改:(使用"git重置头.“到前台)
new file: project/swiftFile1.swift
new file: projec/swiftFile2.swift
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to disca
我不小心在我的git提交中添加了一些大文件。在此之后,我删除了大文件,现在我想提交其余的更改(不包括大文件),但不知何故,大文件的删除仍然在我的git历史中,因此我不能进行任何进一步的提交。我不想让git重置或其他东西丢失很多我的本地更改。我该如何解决这个问题? 我的步骤: git add -A
git commit -m "Commiting with Large Files"
git push origin main
-- Failed to push due to Large files 现在,我从本地计算机上删除了这些大文件,并再次尝试推送 git add -A
gi
我有两个本地存储库(比如A和B)和一个远程存储库。不幸的是,我在A中添加了一个巨大的文件夹并将其推送。由于我想将其放入第三个本地存储库C(我的笔记本电脑)中,因此不再可行。然后我想撤销在A中添加的巨大文件夹,并尝试git filter-branch命令,该命令在超出磁盘配额时以错误终止。现在,当我在A中运行du -h时,它会显示几个./.git-rewrite文件,即使我在添加这个大文件之前签出了一个提交。 现在-有什么方法可以撤销git filter-branch命令吗?(我的怀疑是git历史中有一些改变,我不想冒任何损害的风险),因为我会使用Delete commits from a b