运行 Git commit 时出现以下错误:
c:/Program/ Files/ /(x86/)/Notepad++/notepad++.exe: -c: line 0: syntax
error near unexpected token `('
c:/Program/ Files/ /(x86/)/Notepad++/notepad++.exe: -c: line 0: `c:/Pr
ogram/ Files/ /(x86/)/Notepad++/notepad++.exe \$@\'
error: There was a problem with the editor 'c:/Program/ Files/ /(x86/)
/Notepad++/notepad++.exe'.
Please supply the message using either -m or -F option.
Run Code Online (Sandbox Code Playgroud)
这是什么意思?我该如何修复它?
这是发生的事情:
我想我的问题是:为什么在第 2 项中提交的代码没有出现在我的新 PR 中?即使我在更改文件列表中没有看到已恢复的提交,也会包含在这个新 PR 中吗?
谢谢!
我有 7 个文件想要提交到远程存储库,这些文件以“Sanity....”一词开头
例如 Sanity1、Sanity2、Sanity3 等。
我希望能够使用通配符字符串一次性提交它们,而不是尝试一一提交它们。
请问这可能吗?
谢谢
我已经创建了 ssh 密钥并将其添加到我的 gitlab 帐户中。
然后,我做出了承诺:
git add .
git commit -m "w"
git push origin master
Run Code Online (Sandbox Code Playgroud)
但正如你所看到的,我提交时的用户名是root(这是因为我笔记本电脑上的用户是root
1)如何设置所需的用户名(让我们称之为)batman,这样我希望将batman显示为提交作者而不是root?
2)我可以只使用 gitlab 界面来完成此操作,而不弄乱笔记本电脑上的 git 配置吗?(我这样问是因为我有几个 git 帐户,并且我需要为我的项目使用不同的帐户)
我提交了,然后尝试将太大而无法上传到 GitHub 的文件推送。我如何“清除”此提交以便能够进行另一个提交并推送它?
在GitHub 文档页面上,我看到了以下命令:
Run Code Online (Sandbox Code Playgroud)$ git commit --amend -CHEAD # Amend the previous commit with your change
我git commit --amend以前使用过该命令,但还没有遇到过这个-CHEAD参数。在这种情况下是什么-CHEAD意思,它与 有何不同--no-edit?
我正在尝试根据 Angular 约定开始使用语义提交消息https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines https://docs.google。 com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
但在我的项目中安装新的依赖项时仍然找不到正确的提交类型。最后,它应该像这样结束<commit type>: install storybook。我应该使用什么类型?
当我尝试使用以下命令进行提交时,我在提交时遇到问题,例如:
$ git commit -m "add readme"
pre-commit not found. Install pre-commit with the command pip3 install --user pre-commit or follow the steps on official documentation: https://pre-commit.com /#install
Run Code Online (Sandbox Code Playgroud)
按照我通过命令安装的预提交安装文档中描述的步骤:
$ pip install pre-commit
Run Code Online (Sandbox Code Playgroud)
但是,当我触发命令时,会发生以下错误:
$ pre-commit --version
bash: pre-commit: command not found
Run Code Online (Sandbox Code Playgroud)
我的尝试失败了,所以我尝试了一些其他解决方案,但它们不起作用。
我已经尝试过所描述的解决方案,即使用~./bashrc命令导出我的:source ~/.profile但出现以下错误:
bash:/Users/pvieira/.profile: No such file or directory
Run Code Online (Sandbox Code Playgroud)
这会导致与上述手动安装时发生的错误相同的错误pip。
我在日志语句中添加了更多详细信息,例如
从logger.error('An error occurred')到logger.error('An error occurred for ${client.id})
在常规提交下使用什么是好的提交类型?
我知道有两种方法可以更改 git 中的提交消息。
第一个是git amend,它仅适用于最新的提交。由于我希望能够直接更改较旧的提交消息,因此这不是我想要的。
第二个是交互式变基,例如本答案中描述的,它也可以更改旧提交的提交消息。程序是使用
git rebase -i HEAD~n
Run Code Online (Sandbox Code Playgroud)
我必须手动计算n我的具体情况有多大,然后滚动浏览所有这些提交的列表并将一个提交从 更改为pick,reword最后键入新的提交消息并强制推送。
老实说,虽然这可行,但这样做非常复杂且乏味。所以我的问题是,是否有一种更易于使用的选项(可能以别名的形式),可以一步自动执行此过程?
理想情况下,我想要一个像这样的命令:
git reword <hash> -m "New commit message"
Run Code Online (Sandbox Code Playgroud)
然后用力推动。这可能吗?
编辑:我想摆脱交互性,因为我想以编程方式自动化程序中的一些 git 命令。在此过程中必须手动与 git 交互,这违背了这种自动化的目的。
git ×10
git-commit ×10
github ×4
bash ×1
git-revert ×1
gitlab ×1
pre-commit ×1
pull-request ×1
wildcard ×1