0
私はに本当にのgitリポジトリ内のチェンジセットを削除しようとしています。私はgit reset --hard
を使用していますが、まだ私が古いチェンジセットを回復できるようだ:gitリポジトリにチェンジセットを完全に埋め込む方法は?
% git init
Initialized empty Git repository in /tmp/ross/test/.git/
% echo hi > hi; git add hi; git commit -m hi hi
[master (root-commit) 3ef4ac5] hi
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 hi
% echo bye > bye; git add bye; git commit -m bye bye
[master 966b136] bye
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 bye
% git tag mytag
% git log # grab the 'hi' sha number
% git reset --hard 3ef4ac559079c3b463374a51fb460d46ade396dc
HEAD is now at 3ef4ac5 hi
% git checkout mytag
Note: checking out 'mytag'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 966b136... bye
なぜ私はまだ私はgit reset --hard ...
コマンドをした後bye
タグmytag
にコミットチェックアウトすることができますか?私はgit reset --hard
が完全にそれらの編集を拒否することになっていたと思いましたか?チェンジセットを本当に本当にヌークする方法はありますか?
私が 'reset -hard'を実行してからチェンジセットを作成し続ければ、削除したチェンジセットを持っている他の誰かから引き出すことができますか? (私は古いバージョンのリポジトリで作業しようとしています。最終的には誰かがメインラインを修正していますので、削除した編集内容を再取得する必要があります)。私のレポには、これが他人の「プル」を台無しにすることがある。 –
もう一度「削除」しませんでした。誰かが何かを壊して作業用のバージョンに戻ってしまったためにリセットしただけで、後で壊れたものを修正した後で再度取りたい場合は、心配しないでください。これはかなり普通の出来事です。私。あなたはAで始まり、Dに到達するためのプルを行い、次にAにリセットし、その後Eを引きます(Dの後にコミットします)。その間にAにもう一度コミットしても、それでもすべて上質で良い。それはちょうど普通のプルです。 –