To https://github.com/yourusername/repo.git ! [rejected] mybranch -> mybranch (non-fast-forward) error: failed to push some refs to 'https://github.com/tanay1337/webmaker.org.git'hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards'in'git push --help'for details.
在你执行了交互式 rebase的命令(interactive rebase command)后, 你将在你的编辑器里看到类似下面的内容:
picka9c8a1d Some refactoring pick01b2fd8 New awesome feature pickb729ad5 fixup picke3851e8 another fix # Rebase 8074d12..b729ad5 onto 8074d12 # # 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 # # These lines can be re-ordered; they are executed from top to bottom. # # If you remove a line here THAT COMMIT WILL BE LOST. # # However, if you remove everything, the rebase will be aborted. # # Note that empty commits are commented out
picka9c8a1d Some refactoring pick01b2fd8 New awesome feature sb729ad5 fixup se3851e8 another fix
Newer, awesomer features # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # rebase in progress; onto 8074d12 # You are currently editing a commit while rebasing branch 'main' on '8074d12'. # # Changes to be committed: # modified: README.md #
(main)$ Successfully rebased and updated refs/heads/main.
(my-branch)$ git status On branch my-branch Changes not staged for commit: (use"git add ..."toupdate what will be committed) (use"git checkout -- ..."to discard changes in working directory) modified: README.md 在这个例子里面, README.md 有冲突。打开这个文件找到类似下面的内容: <<<<<<< HEADsome code ========= some code >>>>>>> new-commit
$ git config --global credential.helper cache # Set git to use the credential memory cache $ git config --global credential.helper 'cache --timeout=3600'# Set the cache to timeout after 1 hour (setting is in seconds)