0 votes
1 view
in DevOps and Agile by (20k points)

I am getting the following when running git status

Your branch is ahead of 'origin/master' by 3 commits.

I have read on some other post the way to fix this is run git pull --rebase but what exactly is rebase, will I lose data or is this simple way to sync with master?

1 Answer

0 votes
by (28.4k points)

You get that message as a result of you made changes in your local master and you did not push them to remote.

You have many ways to "solve" it and it usually depends on how your workflow appearance is:

  • In a sensible workflow your remote copy of master ought to be the good one while your local copy of master is just a replica of the one in remote. nUsing this workflow you'll never get this message again.
  • If you work in another way and your local changes should be pushed then just git push origin assuming origin is your remote
  • If your local changes are bad then simply remove them or reset your local master to the state on remote git reset --hard origin/master

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...