科学の箱

科学・IT・登山の話題

IT

ブランチを切り替えるタイミングについて調べる

投稿日:

OTRSシステムのチケットをトピックとしてgitにブランチを作って変更をする際の手順について確認してみる。

ここでは架空のOTRSチケット OTRS#25645OTRS#25645についてフィックスする。masterからfeatureブランチを使って修正してみる。その際に開発していると起きそうなことを実際に試してみる。
masterからfeature-25645を作成する

git checkout -b feature-25645

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ブランチにもどれない。しかし同時進行で作業を進める場合にはワーキングツリーあるいはステージングエリアの変更が終わったタイミングで別のブランチにも取りたいときがある。

ブランチの移動はcommitをしなければできない。小さな変更でもよいのでcommitできるようにしあげる。commitをしたらgit checkout masterでマスタブランチに戻れる。

featureブランチをマージしていなければここから別のfeatureブランチを生成することが可能である。

 

メタ情報

inarticle



メタ情報

inarticle



-IT
-

執筆者:


comment

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

関連記事

no image

chefでyum updateを実行するための手順

まずクックブックを作成する knife cookbook create yumupdate -o site-cookbooks ./recipe/default.rbを編集する execute “yu …

no image

Windows 7 <-> Windows 2008 R2でファイル転送が遅い

こちらが続編になります。Windows 7でCIFS遅延が解決した Windows 7 <-> Windows 2008 R2で通信をする際にWindows 7からWindows 2008 …

no image

gem ssl error

gem install chef –no-ri –no-rdoc ERROR:  Could not find a valid gem ‘chef’ ( …

no image

Networker Enterprise Reportの使い方 – Events

Networkerで用意されているEnterprise Reportについてその種類、提供されている情報の内容について簡単にまとめた後、トラブルやケースに合わせた使い方を考えてみる。 Events E …

no image

cpuに負荷をかける

yes > /dev/null & Related posts:Global CatalogサーバーSharePoint Workspaceが保存しているキャッシュファイルの場所gitの …

2014年8月
« 7月   9月 »
 123
45678910
11121314151617
18192021222324
25262728293031

side bar top



アーカイブ

カテゴリー