6 ms·
"Your branch is up to date with origin/master" is the biggest lie i am being told on daily basis. I just "pull" every time
by dgan 3y ago
"Your branch is up to date with origin/master" is the biggest lie i am being told on daily basis. I just "pull" every time
- abledon 3y agoshould be "Your branch is up to date with the local copy of origin/master, last updated on XXXX-XX-XX:XX:XX:XX" haha
- pests 3y agoThat sounds like the origin/master branch last got an update on XXXXXXXXXX, not that you checked out your local copy on that. I would fetch and then be wondering why nothing charged. Further it does nothing - it tells you nothing about the remote. It could be 1 second or 100 years and you would still need to fetch to determine if anything is different. Then what is the information for?
- SAI_Peregrinus 3y agoBy the last line's logic there would need to be an atomic fetch & compare. `git fetch && git status` still has the same race condition!
- jlarcombe 3y agothat's the most common confusion yes! along with 'stage' vs 'cache' vs 'index'.
- Lutger 3y agoNice. But technically its true. origin/master is not master on origin. It just refers to the last known commit pointed to by origin/master, which gets updated when you fetch (pull automatically fetches). ls -l .git/refs/remotes/origin/master origin/master is just a file on your system, you can see when it has been changed. It doesn't magically get updated. Do `git fetch origin` and if there are any changes, you'll see the timestamp change, and the contents: cat .git/refs/remotes/origin/master The basics of git are so simple, you can implement the core data structures and some operations in a day. It is really worth it to get to know these. Somehow git has managed to create a very complex user interface on top of quite a simple core.
- cush 3y ago> It just refers to the last known commit pointed to by origin/master The confusion lies in that origin refers to different things depending on if it's `origin master` or `origin/master`. Eg `git pull origin master` does the thing we expect
- metabagel 3y ago> The confusion lies in that origin refers to different things depending on if it's `origin master` or `origin/master`. Git is not well designed for human beings.
- Y-bar 3y ago> But technically its true. Is it though? Consider a bank telling a store I am buying things at "This person has has €450 in their bank account", when at that moment I have €310. The store would be rightfully pissed at the bank for effectively lying when it is made clear later on that the transaction could not be completed and the bank answers "well, the person had €450 a few days prior to you asking us". Without an explicit temporal information it is explicitly now. Without an explicit status on sync status it is implicitly saying sync is up-to-date. It's a lie of omission.
- fernandotakai 3y ago>It's a lie of omission. but it's not? if you have an old bank receipt that says you have $450 in your account, but you actually have $310, you need to "get" a new receipt that has the newest value. you do that by issuing git fetch origin. then you can git merge origin/master to make everything up-to-date.
- Y-bar 3y agoBank receipts always have a date and time, that's _exactly_ the point I am making, the omission is part of the lie.
- 3y ago
- e40 3y ago> I just "pull" every time I hope you "git pull -r" every time. Merges are almost always unwanted.
- flostk 3y agoThat's just saying git doesn't connect to the internet (or whereever the remote is) to check for updates without you explicitly telling it to. I think that's a desirable property, though the message could be clearer.
- leni536 3y agoWhat I do is I delete the local master branch. I typically can't push to master, or I don't want to work on master directly anyway, so why have a local mutable master branch? So I only need to update origin/master, which I can do with fetch.
- sensanaty 3y agoHow do you make a branch based off master though? I never work on master, but my workflow is `gs master && git pull && git switch -c my-branch-name` so that my branch at least starts off with the latest master, willing to learn shorter/quicker variant of this though
- leni536 3y agogit fetch && git checkout -b my_branch origin/master
- jerhewet 3y agogit fetch && git pull. (very large sigh) Can't wait to retire in three years and wash my hands of this broken trash.