GithubHelp home page GithubHelp logo

Comments (3)

sideshowbarker avatar sideshowbarker commented on June 18, 2024

One way we could check strictly with git and without a git fetch is to use git remote show ….

Part of the last line of git remote show … will always say either local out of date or up to date.

To get the info we’d need and regardless of the remote names or how many the user has, we could do:

for remote in $(git remote show | xargs); do \
    echo "$remote: $(git remote show $remote | tail -n1 | xargs)"; \
done

And for the normal case if the local clone is out of date with the remote that will just report this:

origin: master pushes to master (local out of date)

And If the user has multiple remotes configured, an additional line like that for each remote.

So we could grep the output of for each local out of date and then report to the user:

Your local clone is out of date with the "origin" remote.
Run "git pull" to bring your local up to date with the "origin" remote.

from html-build.

sideshowbarker avatar sideshowbarker commented on June 18, 2024

After thinking about this some more, I think we can better get what we’d need with just this:

git remote show $(git remote -v \
    | grep "https://github.com/whatwg/html.git (fetch)" | cut -f1) \
    | grep "pushes to master" | xargs

That’ll give just the info for the master branch of the whatwg repo. We could then word the message as:

Your local clone is out of date with the WHATWG remote repo.
To bring your local up to date with the WHATWG remote, run this:

     git checkout master && git remote pull https://github.com/whatwg/html.git master

from html-build.

foolip avatar foolip commented on June 18, 2024

A problem with the git remote show approaches is that it'll just tell you the status of the master branch. If people are on a PR branch that's far behind master, it doesn't catch that.

I think that git fetch https://github.com/whatwg/html master and some fiddling with FETCH_HEAD should work, though.

from html-build.

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.