科学の箱

科学・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環境構築

Mahoutのシステム要件を確認する。 Java 1.6.x or greater. Maven 3.x to build the source code. CPU, Disk and Memory …

no image

berkshelf error

これは何だろう WARNING: Berkshelf could not be loaded WARNING: Please add the berkshelf gem to your Gemfile …

no image

10 thing you know about UPS

http://www.techrepublic.com/article/10-things-you-should-know-about-deploying-a-ups/ Related posts:u …

no image

DellラップトップのBreakキー

DellラップトップにはBreakキーがない機種がある。 この場合にはFn+BでBreakキーが使える。 参考 https://www.dell.com/support/article/jp/ja/j …

no image

daemon.rawを人が読めるようにするためのコマンド

Networkerでトラブルシューティングをする時のファイルとしては以下が必要となる。 $nsr\logs\daemon.raw $nsr\logs\messages $nsr\logs\savegr …

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

side bar top



アーカイブ

カテゴリー