git push後に合併する前のcomit
2234 ワード
リンクを開くにはクリックしてください。
Merge or squash comits in git after pused
referer url: http://stackoverflow.com/questions/5189560/how-can-i-squash-my-last-x-commits-together-using-git
FOR EXAMPLE: I have 3 comits in history:comit 1:_zzzzzzzzzcomit 2:333322yyyyyycomit 3:_xxxxxxNOW、I want to squast 2 comits
Step 1:
Merge or squash comits in git after pused
referer url: http://stackoverflow.com/questions/5189560/how-can-i-squash-my-last-x-commits-together-using-git
FOR EXAMPLE: I have 3 comits in history:comit 1:_zzzzzzzzzcomit 2:333322yyyyyycomit 3:_xxxxxxNOW、I want to squast 2 comits
Step 1:
$ git reset --hard HEAD~2
then the out put like this:HEAD 4cf49a1 #255
Step 2:$ git merge --squash HEAD@{1}
then the out put like this: 4cf49a1..399379d
Fast-forward
-- HEAD
Controller/0000Controller.php | 65 +++++++++++++++++++++++++
Controller/111111Controller.php | 22 ++++++++-
Model/33333.php | 78 +++++++++++++++++++++++++++++-
View/44444/5555.ctp | 10 +++-
View/4444/666666.ctp | 41 ++++++++++++++++
webroot/js/44444/xxxxx.js | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 381 insertions(+), 3 deletions(-)
create mode 100644 View/aaaa/xxx.ctp
create mode 100644 webroot/js/aaaa/bbbb.js
Step 3:$ git commit -m "#255 aaaaaa"
OUT:[master 8f35d2d] #255 aaaaaa
6 files changed, 381 insertions(+), 3 deletions(-)
create mode 100644 View/aaaa/bbbb.ctp
create mode 100644 webroot/js/aaaa/bbbb.js
Step 4:$ git push
OUT:To [email protected]:xxxx/bbbb.git
! [rejected] master -> master (non-fast-forward)
error: '[email protected]:xxxx/bbbb.git'
: , 。
: , ( 'git pull')。
:'git push --help' 'Note about fast-forwards' 。
if push get errors,you need to force push:$ git push origin +master
OUT:Counting objects: 27, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (15/15), 4.03 KiB | 0 bytes/s, done.
Total 15 (delta 9), reused 0 (delta 0)
To [email protected]:aaa/xxx.git
+ 399379d...8f35d2d master -> master (forced update)