Code Monkey home page Code Monkey logo

Comments (1)

HonkingGoose avatar HonkingGoose commented on May 24, 2024

Thanks for the issue report.

The basic problem is that git status will straight up lie to you about the status of your origin/main branch, if you don't first do a git fetch --all to update what Git knows.

Also git status will only show you the status compared to the origin/main branch as that is the tracking branch for the local main branch. You'll need to manually figure out where you are in relation to the upstream branches with other Git commands.

This will be added to the guide for sure, as I see new developers struggle with this all the time.


Git fetch to check for updates to fork and remotes

Use git fetch --all --prune, to check for updates on your fork and remotes, --prune will remove pointers to branches on the origin or upstream that are no longer present.

Check local branches

Use git branch -vv to check all your local branches.
You can remove local branches that are gone on the remote with git branch -D name_of_branch_to_remove.

Getting a list of all remotes with:

$ git remote -vv

origin	https://github.com/RoostingGeese/git-gosling.git (fetch)
origin	https://github.com/RoostingGeese/git-gosling.git (push)

Configuring a remote for a fork

If you are using a fork, you should setup a new remote called upstream that points to the upstream project.

$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/configuring-a-remote-for-a-fork

Checking where you are in relation to all other branches

I recommend you try out git log --all --decorate --oneline --graph.
This will give you a big overview of all commits on all branches.
That way you can compare if you are ahead/behind of the upstream branch.

from git-gosling.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.