我是git的新手,我正在努力理解壁球和篮板之间的区别.根据我的理解,你做一个篮板时做一个壁球.
我在GitHub上发了一个pull请求.现在,存储库的所有者正在说要将所有提交压缩成一个.
当我键入git rebase -iNotepad打开时,其中包含以下内容:
noop
# Rebase 0b13622..0b13622 onto 0b13622
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# …Run Code Online (Sandbox Code Playgroud) 我想用提交消息"first"和"second"来压缩两个最新的提交.首先我拉主人然后我使用命令
git rebase -i HEAD~2 master
Run Code Online (Sandbox Code Playgroud)
它向我展示了这样一个编辑器中的两个提交:
pick first
pick second
Run Code Online (Sandbox Code Playgroud)
然后我将此编辑器更改为:
pick first
squash second
Run Code Online (Sandbox Code Playgroud)
保存更改后,我收到此消息:
Successfully rebased and updated refs/heads/master.
Run Code Online (Sandbox Code Playgroud)
它确实改变了远程主人的任何东西.要应用这些更改,我使用该git push命令并收到以下错误:
To https://github.com/aneelatest/GITtest.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/test/GITtest.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' …Run Code Online (Sandbox Code Playgroud)