科学の箱

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

WordPressのサイトURLを変更する

WordPressをインストールしたディレクトリとサイトURLを変更する方法 WordPressをインストールしたときにはテストから始まるのでいつもルートディレクトリ/wpにインストールする。開発およ …

no image

slickrunの日本語環境用magicword

jpdefault Related posts:WordPressのサイトURLを変更するOutlook – Cannot perform the requested operation.chefでn …

no image

Lyncのレジストリキー

Lync 2013クライアントの設定はレジストリに保管される。このキーの場所は以下になる。 HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Lync …

no image

Expireしていないメディアを再利用する手順

Networkerではバックアップしたデータに保管期限を設定できる。これをExpireやBrowsibleと呼んでいる。保管期限は会社で決められたバックアップポリシーに従うことが多い。公的なコンプライ …

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 …

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

side bar top



アーカイブ

カテゴリー