几个月前有人犯下了某件事。之后,还完成了多个其他提交。是否可以查看某人是否通过修改或变基更改了某个提交的内容?如果是,怎么办?
我已经将一些更改推送到了遥控器。现在我需要推送一些其他更改,这些更改应该包含在之前推送的提交中,但不知何故却没有。我可以简单地通过新提交推送更改来做到这一点,但现在我已经找到了标志--no-edit并且--amend
如果我需要推送新的更改,但我需要一次提交新旧更改才能git commit --amend --no-edit实现这一目标?
* 84b134d - (HEAD, origin/lab_master, lab_master) comment macro defination which is protent to be a fun
|\
| * 735d88f - add small script to ease ctag related option (13 minutes ago)
* | 6623a94 - add small script to ease ctag related option (4 minutes ago)
|/
* 0d0913a - add gitignore to ignore ctags file (57 minutes ago)
Run Code Online (Sandbox Code Playgroud)
735d88f是--amend提交,但是此时发生冲突,为什么?
我只有一台PC,而且我总是在上面编辑文件,我也只有一个本地存储库,此外,此存储库仅在此处使用,我认为不可能发生冲突吗?
但是发生了,为什么呢?
我在尝试修改提交以更改作者时遇到了此错误。
git commit --amend --author="First Last example@example.com"
Run Code Online (Sandbox Code Playgroud)
fatal: --author 'First Last example@example.com' is not 'Name <email>' and matches no existing author
Run Code Online (Sandbox Code Playgroud)
它与本文中描述的问题类似,但错误消息不同,因此很难找到解决方案。
我该如何解决这个问题?
我有一个feature名为的分支featureA,我是唯一正在并将接触该分支直到它合并到master分支的开发人员。
我的 git 命令历史记录是:
但它似乎没有推送到远程存储库。
git status输出:您的分支 和origin/featureA已经出现分歧,并且分别有 1 个和 1 个不同的提交。(用于git pull将远程分支合并到您的分支中)
git diff表明:我的featureA分支将被合并到master分支,所以我不想破坏历史。
我经历了几个线程(建议git pul --rebase,git reset --hard等等),但仍然不清楚什么是最好的解决方案。
我不介意解决方案将处于哪种状态。如果需要,我不介意返回到之前的推送/提交并再次将新更改作为新提交推送,因为这只是单行代码更改。
我感谢您的帮助。
今天我发现--no-edit了--amend.但是,它引出了以下问题.这里的步骤:
git push origin master
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://me@bitbucket.org/myRepo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)为什么?
注意:我是唯一一个处理该回购的人.