私が支店にいるときに、コミットされていない変更を支店のTESTにどのように適用できますmaster
か?
46014 次
4 に答える
195
また、次の手順を実行して、新しいブランチを作成し、それに切り替えることができます。
git checkout -b new_branch
git add .
コードの編集を開始する前に新しいブランチを開始することを常に忘れているため、これを常に使用しています。
于 2010-12-17T00:31:54.887 に答える
36
git stash を使用してみませんか。コピペよりも直感的だと思います。
$ git branch
develop
* master
feature1
TEST
$
現在のブランチに移動したいファイルがいくつかあります。
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: awesome.py
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# modified: linez.py
#
$
$ git stash
Saved working directory and index state \
"WIP on master: 934beef added the index file"
HEAD is now at 934beef added the index file
(To restore them type "git stash apply")
$
$ git status
# On branch master
nothing to commit (working directory clean)
$
$
$ git stash list
stash@{0}: WIP on master: 934beef ...great changes
$
別のブランチに移動します。
$ git checkout TEST
そして応募する
$ git stash apply
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# modified: awesome.py
# modified: linez.py
#
また、作業ディレクトリに変更が残っている間に機能ブランチを終了したい場合に不平を言うgit stash
を使用しているため、私も気に入っています。git flow
@Mike Bethanyと同じように、これは常に私に起こります。これは、私がまだ別のブランチにいることを忘れながら、新しい問題に取り組んでいるためです。したがって、作業を隠して、新しいgit flow feature finish...
ブランチにgit stash apply
移動git flow feature start ...
できます。
于 2012-11-13T17:46:12.713 に答える