Live data from Hacker News

New in Git: switch and restore

banterly.net

401–410 of 550 posts

Re: New in Git: switch and restore

#401

Earlier quoted context omitted.

It's not the correct solution because it requires knowledge of the intent of the project leaders, which is not easily available to us. A much better response would be, "Thanks for pointing that out! I have filed an issue." One can't simultaneously through shade for not being community-spirited while expecting other people to do all the work.

> "Thanks for pointing that out! I have filed an issue." This means, here's my problem, someone else fix it for me. Since it has not been fixed for YEARS, maybe not the best alternative if you want to get it fixed.

If it truly hasn't been fixed for years, then either the people involved haven't noticed or don't care. If the former, filing an issue is helpful. If not, filing a patch may not get anything fixed either.

Re: New in Git: switch and restore

#403

Earlier quoted context omitted.

You're missing out. You need rebase and cherry-pick. Merging sucks.

Merging rocks! Never had an issue with merging and it’s less work. I’d only rebase if there is a “story” I want to tell in the commit history, that would be otherwise lost. This is rare, probably if someone else did some major refactor or move around

Merging makes life harder for others, and easier for you. Rebasing does the opposite, but has other benefits.

Re: New in Git: switch and restore

#404
post #80

A lot of comments along the lines of ‘why do people use instead of learning the commands’. For me, I used to use the terminal git, and I still do occasionally. But I use Sourcetree now for most things because I make less mistakes seeing the tree visually all the time. My job isn’t to use git, it’s to write specialist software. If I get the software written and the customer is happy, it doesn’t matter whether I use or…

I completely agree. It always baffles me how something so simple (yes, simple!) as version control can end up as the abomination that is git. After controlling for popularity, you don’t see nearly as much posts explaining subversion in detail, and subversion being centralized is neither the only nor the biggest reason for that.

Git's basic problem is that it has a really a good model for the data, but a really terrible CLI.

Re: New in Git: switch and restore

#405

> with git checkout you can create and switch to the new branch in one command using the -b flag: git checkout -b new_branch > You can do the same with the new one, but the flag is -c: git switch -c new_branch It's like they had a design meeting where they discussed this and said "so I propose switch -b newbranch to create and switch to a new branch" and the objection was "nah that would make it consistent with check…

The purpose of `git switch` is to switch branches, and its normal argument is a branch ref. Thus -b for "branch" would be redundant and confusing. -c is for "create", i.e. create the branch that i want to switch to.

The whole point of adding git switch and git restore is to come up with more user friendly porcelain. Otherwise we might as well stick with git checkout. git checkout is maximally consistent with git checkout!

Re: New in Git: switch and restore

#406
post #241

Earlier quoted context omitted.

Yeah, viewing a changeset and staging only some files or just parts of files is really important to my workflow. Sometimes I leave myself comments or skip tests locally and I have no intention of committing those changes. Using a tool like sourcetree to review, add, and commit only the lines I want is very helpful and saves me time. I do use the command line for everything else, though. Well except interactive rebasi…

This is also part of my workflow, that I use git commit -p instead. Seems weird to only use a tool for that part when git's included workflow is perfectly capable

My most favorite shell alias is `gap`:

    alias gap="git add -p"
Probably SourceTree makes this workflow better (git add -p is a forward-only workflow, so you can't glance up and down a file, for example), but it's so ingrained in my fingers that I'd have a hard time switching things up.

Re: New in Git: switch and restore

#407
I remember learning `git checkout` checked out files from a specific branch and the default behavior was to checkout all the files of the current branch and it made sense except for one thing. If I check out one file from another branch, HEAD is still pointing to my current branch, if I check out all but one file from another branch it's the same, but if I check out all files, then HEAD points to the other branch and that seems inconsistent. I always thought there should be one command that switched branches and then checkout changed the files.

Re: New in Git: switch and restore

#409

Earlier quoted context omitted.

git add -p

Oh thanks, that works fairly well. I still prefer git-gui for this, but this will work nicely when I'm ssh-ed into a machine with no GUI.

Magit is the king of staging and unstaging. You can even use it on remote systems via TRAMP.

Re: New in Git: switch and restore

#410

Earlier quoted context omitted.

"Noob" has a negative connotation. https://www.urbandictionary.com/define.php?term=Noob > Contrary to the belief of many, a noob/n00b and a newbie/newb are not the same thing. Newbs are those who are new to some task* and are very beginner at it, possibly a little overconfident about it, but they are willing to learn and fix their errors to move out of that stage. n00bs, on the other hand, know little and have no wil…

Indeed, and it should be clear that "noob" is intentionally/cleverly spelled like "boob" in the sense of "idiot". That's the whole point of the word -- that's the joke. Now it's fine to joke around and call yourself a noob, that's just self-deprecating. But if you're talking about other people and don't want to inadvertently offend, stick to "newbie" in speech or "newbie/newb" in writing, which have a connotation ent…

I've been using the term noob for decades. Reading your comment is the first time I've ever seen anyone compare it with boob. There is a big world out there, with lots of different people using words to mean things.
Post reply on HN