科学の箱

科学・IT・登山の話題

IT

gitでコードを修正する場合に使ったコマンド

投稿日:

gitにpushしてからソースコードを一部変更したい

git remote上での修正

git remote上で直接編集する。これは意味がない。新しいcommitとして取り扱われるだけ。

 

git filter-branch

下記はcommit関連の情報を修正するだけなのでソースには影響がない

git filter-branch –commit-filter ‘
if [ AZ_E=”xxxxx@xxxxx.com” ];
then
AZ_E=”xxxxxxx@xxxxxx.com”
git commit-tree “$@”;
else
git commit-tree “$@”;
fi’ HEAD

 

git push -f origin master

git pushで下記のエラーが出たら-fをつけて強制的にpushする。

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.

git reset –hard HEAD~

直前のcommitを消し込む。複数回実行すれば順番にcommitがなくなる。

git update-ref

git reset –hard HEAD~を実行すると別のブランチができる。これを削除する。

メタ情報

inarticle



メタ情報

inarticle



-IT
-

執筆者:


comment

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

関連記事

no image

slickrunの日本語環境用magicword

jpdefault Related posts:PGP WDE Tools with Windows PE 2.0最新の情報通信白書hashicorpのconsul

no image

Smokepingのセットアップ

Smokepingをセットアップする手順をまとめてみる。 必要なツールのインストール RRDTool SmokepingはRRDTool利用してログの収集とグラフを作成する。RRDToolはバージョン …

no image

さくらVPS – 初期設定

こちらを参考にして初期設定と基本アプリケーションを導入 yumの初期設定 yum -y update yum -y install yum-cron /etc/rc.d/init.d/yum-cron …

no image

TypeError: $(…).live is not a function

ドットインストールでRuby on Rails 3.0を勉強していたところ、一か所どうしてもエラーが消えない部分があった。 メッセージは.liveが関数ではないといっているのだがタイポも見つからず、ド …

no image

Networker Enterprise Reportの使い方 – Events

Networkerで用意されているEnterprise Reportについてその種類、提供されている情報の内容について簡単にまとめた後、トラブルやケースに合わせた使い方を考えてみる。 Events E …

2018年11月
« 10月   12月 »
 1234
567891011
12131415161718
19202122232425
2627282930  

side bar top



アーカイブ

カテゴリー