0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Git】git stashコマンドでバージョン管理されているファイルを退避させたい

Last updated at Posted at 2024-08-09

アジェンダ

  • バージョン管理されているが、リモートに反映させたくない特定のファイルを、一時的に追跡させないようにしたい
  • git stashコマンドを使う

手順

  1. 退避させたいファイルをスタッシュする
    zsh
    git stash push -m "一時退避" -- src/config/IpList.php
    
    // 複数の対象があれば指定する
    git stash push -m "一時退避" -- src/config/IpList.php src/config/AdminList.php
    
  2. 本来、リモートにプッシュしたいファイルをcommit等する
    zsh
    git add src/components/common/button.tsx
    git commit -m "fix ボタンをホバーした際の挙動を修正"
    git push origin Feature/Task_03
    
  3. 退避させているファイルを復帰させる
    zsh
    git stash pop
    

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?