git: Your branch is ahead by X commits

git: Your branch is ahead by X commits

Asked on January 8, 2019 in Git.
Add Comment


  • 4 Answer(s)

    Git pull remote branch, following it to git fetch. voluntarily, run git fetch -p to trim deleted branches from the repo

    To update the local representation of the remote branch, to do a git pull remote branch.

    Answered on January 8, 2019.
    Add Comment

    Try

    git pull --rebase
    
    

    –rebase option to synchronise the remote commits from the new state..

    Answered on January 8, 2019.
    Add Comment

    Try these 3 simple commands:

    Procedure 1:   git checkout <branch_name>

    Procedure 2  git pull -s recursive -X theirs

    Procedure 3:   git reset –hard origin/<branch_name>

     

    Answered on January 8, 2019.
    Add Comment

    Someone said you might be misreading your message, you aren’t. This issue actually has to do with your <project>/.git/config file. In it will be a section similar to this:

    [remote "origin"]
        url = <url>
        fetch = +refs/heads/*:refs/remotes/origin/*
    

    If you remove the fetch line from your project’s .git/config file you’ll stop the “Your branch is ahead of ‘origin/master’ by Ncommits.” annoyance from occurring.

    Answered on February 20, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.