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?
This message from git means that you have made three commits in your local repo, and have not published them to the master repository. The command to run for that is git push {local branch name} {remote branch name} .
The message you're seeing (your branch is ahead by 1 commit) means that your local repository has one commit that hasn't been pushed yet. In other words: add and commit are local operations, push , pull and fetch are operations that interact with a remote.
A branch can be both ahead and behind at the same time if you have made changes to your branch, and someone else have made changes on the default branch that you have not merged into your branch yet.
You get that message because you made changes in your local master and you didn't push them to remote. You have several ways to "solve" it and it normally depends on how your workflow looks like:
git push origin
assuming origin is your remotegit reset --hard origin/master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With