科学の箱

科学・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

muninのインストールと初期設定

インストール yum経由でインストールする。epelを有効にしておく。 yum –enablerepo=epel install munin ノードもインストールしておく。 yum –enable …

no image

VMWare ESXiで管理インタフェースに接続できない時の対応

esxi起動時に管理インタフェースにうまく接続できなかった。 コンソールをみるとステータス画面が表示されているのでesxiは正しく起動されている。vsphere clientから接続をすると、接続エラ …

no image

Terminal Server License Managerを使っているときのトラブル対応

ライセンスにトラブルが起きたときの対応手順 Licensing Diagnosis: Problems and Resolutions W2k8 R2: Administrator on RDSH g …

no image

The email address that is used in your default Microsoft Office Outlook profile differs from the sign-in address that is used in Office Communicator

OutlookのプロファイルとOffice Communicatorのアカウントが異なると出るエラー。 ワークアラウンドは3つある。 Microsoft Online Service Sign In …

no image

windows updateで再起動が引き起こされた件

エンドユーザーから報告があった。 Windows updateが夜中にインストールされ再起動がかかった。そのために使用していたコールセンターソフトから強制的にログインされたとのこと。 コールセンターソ …

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

side bar top



アーカイブ

カテゴリー