科学の箱

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

Backup group contains no enabled clients , Enable one or more clients then restart the backup operations

Networkerでマニュアル起動の月次バックアップを起動した際にエラーが出て処理が停止した。 Backup group contains no enabled clients , Enable on …

no image

Commvault ジョブプライオリティの設定

Commvaultでリストアを実施したが1Mbyte程度でもまったく終わらない。確認してみたところ並列でジョブが複数流れていることを確認。   ジョブのプライオリティが変えられるのではないか …

no image

Outlook – Cannot perform the requested operation.

Outlookで配布リストに送ると送信エラーが返ってくる。 #550 5.1.1 RESOLVER.ADR.ExRecipNotFound; not found ## 配布リストをクリックして展開しよ …

no image

SQL文を実行前に正しいか確認する方法

SQL文を実行する前に句があっているかを確認したいことがある。 F5を押すとSQL文が実行されるCTRL + F5でSQLのパースだけされ、実行はされない。この時文に間違いがあれば指摘される。 &nb …

no image

ssl_error_no_cypher_overlap

Firefoxで突然出るようになったエラー。SSLで接続をするといくつかのサイトで”Secure Connection Failed”のエラーが出てくるようになった。 Secu …

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

side bar top



アーカイブ

カテゴリー