科学の箱

科学・IT・登山の話題

IT

masterブランチとfeatureブランチの状態が異なるとcommitしなければブランチを移動できない

投稿日:

OTRS#25645についてフィックスする。featureを使って修正してみる。実際に開発していると起きそうなことを実際に試してみる。

masterからfeature-25645を作成する

git checkout -b feature-25645

ここでいったん変更を加えてコミットする。以下のエラーはmasterとfeatureブランチに違いがある場合だけ出る。
feature-25645ブランチをチェックアウトする

$ git checkout -b feature-25645
Switched to branch 'feature-25645'

feature-25645ブランチを編集する

main.javaを編集した

ここでステージングしないでmasterにもどってみる。

$ git checkout master
error: Your local changes to the following files would be overwritten by checkout:
       readme.md
Please, commit your changes or stash them before you can switch branches.
Aborting

ステージングエリアに追加する

$ git add readme.md

マスタに戻ってみる

$ git checkout master
  error: Your local changes to the following files would be overwritten by checkout:
        readme.md
Please, commit your changes or stash them before you can switch branches.
Aborting

変更をコミットする

$ git commit -m "fixed"
[feature-25645 4297f2f] fixed
1 file changed, 2 insertions(+)

マスタにもどる

$ git checkout master
Switched to branch 'master'

feature-25645ブランチで編集を始めると、コミットを完了するまではmasterブランチにもどれない。しかし同時進行で作業を進める場合にはワーキングツリーあるいはステージングエリアの変更が終わったタイミングで別のブランチにも取りたいときがある。どうやって対処するのか。

メタ情報

inarticle



メタ情報

inarticle



-IT
-

執筆者:


comment

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

関連記事

no image

Mahoutで採用されているアルゴリズム

Classifier ロジスティック回帰 ナイーブベイズ ランダムフォレスト クラスタリング K-Means Fuzzy K-Means Canopy レコメンド ユーザーベース アイテムベース NM …

no image

vagrantをubuntuで利用するときのメモ

Vagratnt Vagrantはオープンソースで開発された仮想環境を効率良くインストールするためのツール。プラットフォームとしてはWindows, Linux, Macがある。対象とうなる仮想化ツー …

no image

色選び

1) キーワードから写真を見つける。 input : keyword output : キーワードに紐づく写真 http://www.shutterstock.com/labs/spectrum/?q …

no image

vim設定ファイル

set number inoremap <silent> <Esc> <Esc> inoremap <silent> <C-[> <E …

no image

fingで監視をする

fingにより定期的にLANにつながっているホストについて一覧を記録する。 インストール fingはこちらからダウンロードできる。ダウンロードしたファイルを実行すればインストールされる。途中でパスに追 …

2014年9月
« 8月   10月 »
1234567
891011121314
15161718192021
22232425262728
2930  

side bar top



アーカイブ

カテゴリー