2

I am very new to Github. I cloned a repo and created a test branch. After that I pushed the test branch and created a pull request. After that, I made the changes in test branch and committed the changes.

Before pushing my latest commit in test, I did the following in test branch:

git fetch
git rebase origin/develop

Now, I am trying to run the following command from the test command:

git push origin test

I am getting the following error:

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.

I have already done git fetch and git rebase origin/develop. What should I do now? Why am I getting this error?

Trevor Reid
  • 3,310
  • 4
  • 27
  • 46
Henil Shah
  • 137
  • 4
  • 14

3 Answers3

0

Try This: You have to take pull first.

git pull origin test

After that u can push your data. git push origin test

Pushprajsinh Chudasama
  • 7,772
  • 4
  • 20
  • 43
0

When you rebase, you're rewriting your history (and essentially putting commits from both branches in order) - if you have new commits on your branch this will generally put them in a different chain than they were in before.

This means git will think your branches are out of whack, but if you know that you had the latest before you started, you can force push. This is generally OK when working on a branch by yourself.

If you are working off a shared branch where commits may be coming in regularly, I wouldn't do a rebase but would do regular merges from the other branch instead. This puts all the new stuff at the tip of your branch but avoids any history rewriting.

Joe
  • 41,484
  • 20
  • 104
  • 125
-1

Try This : You can do this git pull shortly after, The screen will appear. There are will be three cards. You can edit card, it according to your own code from.

Before getting the error, you should do definitely git pull. don't forget :)

rslOzl
  • 1
  • 1