私は作者の情報をgoofed。最初のコミット時にブランチ内で唯一のコミットの場合、最初のコミットのみを削除するにはどうすればよいですか?
しかし、リベースやツリーの変更操作のほとんどは、既存の他のコミットに依存しているようです。
私がGitのインタラクティブなrebaseコマンドを実行しても、私の小さなリストのコミットはすべて1行の "noop"です。 :/(。Gitの木のroot
git rebase -i --root
とに対する私のリベースを実行しているが、最初、私は実際に木からそれを削除しなかった作られたコミットの行を削除することによってこれを解決しよう)
root
の上にリベース
、又は第一コミットしても機能しません。
[[email protected] vagrant]$ git rebase -i HEAD~1
fatal: Needed a single revision
invalid upstream HEAD~1
[[email protected] vagrant]$ git rebase -i HEAD
Unknown command: rnoop
Please fix this using 'git rebase --edit-todo'.
[[email protected] vagrant]$ git rebase --edit-todo
[[email protected] vagrant]$ git rebase --abort
以下は、関連する可能な代替の答えのように見えたが、私はもっと何か、あるいは少なくとも、より具体的には、この特殊なケースのための答え価値があると思う:
Delete commits from a branch in Git
この他の回答(How do you undo the last commit?)は、次の結果:ここでは
[[email protected] vagrant]$ git reset --soft HEAD~
fatal: ambiguous argument 'HEAD~': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
[[email protected] vagrant]$ git reset --soft HEAD
、まだこれを読んでそれらのために、vimのバッファがありますnoop
と私は前に述べた:それらのため
noop
# Rebase 3d1c632..3d1c632 onto 3d1c632 (1 command(s))
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
を私はちょうどファイルを編集し、コミット、または何かにそれらを再度追加していない理由を不思議に思って、私は私が持っていた後、私はのみ修正され、間違った著者情報を持っていました"git commit"を実行し、編集のためにコミットメッセージを開いている間に著者情報を変更しました。
おそらく、.git
フォルダ全体を削除しようと思うかもしれませんが、私はよりエレガントな方法を好むでしょう。
さらに、.git
フォルダ全体を削除しなければ、私は自分のフックやものを残しています。この種の質問に対する答えは、私がまだ理解していない基本的な設計原則。
あなたが一人でいたら、あなたのレポだけをコミットしてください。 'git commit --amend'を使うことはできませんか?私はあなたの問題の根底に誤解している可能性が高いです。 – castis