Note that there are some explanatory texts on larger screens.

plurals
  1. POFailed to push some refs when pushing feature branch
    primarykey
    data
    text
    <p>What can I do to avoid getting the following message when I push a feature branch a second time:</p> <pre><code>To https://github.com/xxx/git_test.git ! [rejected] feature_branch -&gt; feature_branch (non-fast-forward) error: failed to push some refs to 'https://github.com/xxx/git_test.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' for details. </code></pre> <p>What I do is this:</p> <pre><code>git pull origin sprint_branch1 git checkout -b feature_branch date &gt; a.txt git add a.txt git commit -m 'added date' git push origin feature_branch </code></pre> <p>Somebody do a code review for my feature and somebody else do changes to the sprint_branch in the mean time:</p> <pre><code>git checkout sprint_branch1 date &gt; a.txt git add a.txt git commit -m 'added another date' git push origin sprint_branch1 </code></pre> <p>I need to improve my feature so I do</p> <pre><code>git checkout feature_branch git fetch origin git rebase origin/sprint_branch1 </code></pre> <p>I get merge conflicts and do:</p> <pre><code>nano a.txt # removing inserted merge tags git add a.txt git rebase --continue </code></pre> <p>then I improve my feature</p> <pre><code>date &gt;&gt; a.txt git add a.txt git commit -m 'add another date again' </code></pre> <p>I like to push my feature_branch for a second review</p> <pre><code>git push origin feature_branch </code></pre> <p>However I get the error message mentioned at the top. Git recommend me to use git pull, but other people recommends me to use the rebase workflow. So what should I do to push the feature_branch? Should I create a new branch named feature_branch_v2 and push that? Do I manually need to remember what files to git add in that case or should I add everything (creating a messy commit)? Is there a better way to push without getting this error message?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload