2017年8月29日 星期二

[ Git 常見問題 ] git merge without auto commit

Source From Here 
Question 
Is it possible to do a "git merge", but without a commit? "man git merge" says this: 
With --no-commit perform the merge but pretend the merge failed and do not autocommit, 
to give the user a chance to inspect and further tweak the merge result before 
committing.

But when I try to use git merge with the --no-commit it still auto-commits. Here's what I did: 
#/b] git checkout master 
Switched to branch 'master' 

[b]#
 git branch 
* master 
v1.0
 

# git merge --no-commit v1.0 
Updating c0c9fd2..18fa02c 
Fast-forward 
file1 | 1 + 
1 files changed, 1 insertions(+), 0 deletions(-)
 

# git status 
# On branch master 
# Your branch is ahead of 'origin/master' by 1 commit. 
# 
nothing to commit (working directory clean)

A subsequent "git log" reveals all the commits from the v1.0 branch merged into master. 

How-To 
Note the output while doing the merge - it is saying Fast Forward! In such situations, you want to do: 
# git merge v1.0 --no-commit --no-ff


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...