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?

Source Treeでスタッシュができない場合の原因と対処

Posted at

備忘録

事象

Source Treeのファイルステータスタブで変更ソースが存在しているのに、スタッシュボタンが押せない。
変更ソースは”application.css”のみ。
このソースは、Sass実装後に自動生成されたソースだった。

分析結果

ターミナルでgit statusコマンドを実行。

>git status
On branch show-articles
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        app/assets/css/application.css

nothing added to commit but untracked files present (use "git add" to track)

解読すると、application.cssは未トラック状態ってこと。未トラック状態とは、ファイルが作成してから一度もgitにaddしてない=gitの管理下に入っていない。よって、addもしくはコミットしないと認識できないということ。

以下ChatGPTより
image.png

原因

単純に、ファイルを一度もgitにコミットしていなかったから。
スタッシュはgit管理下のファイルしかできない。
今回の場合、Sassで実装しているプロジェクトだから、自動生成されるCSSファイルの管理は不要。

対策方法

CSSファイルをGitで認識しない(≒SourceTreeで認識しない)ようにする。
対策方法は別投稿参照。
自動生成ファイルがSource Treeのファイル差分に出てきてしまう場合の対処法

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?