Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Dylan16807
May 12, 2010

ExcessBLarg! posted:

The whole point of running "git checkout ." is to discard non-staged changes. That's not a side effect, it's the only thing the command does. That's like complaining that "rm *" should warn before removing files.

"git checkout branch/commit" updates the index to branch/commit for all files (and HEAD), and preserves local changes.

"git checkout branch/commit $path" updates the index to branch/commit for $path files, and discards local changes.

It's not saying 'rm' should warn about every use, it's saying that 'cd' and 'rm' should be different commands.

Adbot
ADBOT LOVES YOU

Dylan16807
May 12, 2010

ToxicFrog posted:

For that, the natural thing to do would be to use the 'theirs' merge strategy (-s theirs, not to be confused with the 'theirs' merge option -X theirs) -- but it was removed several versions ago for some reason. The git devs recommend using git reset instead, but that'll throw away the history you want to keep.

Probably the easiest workaround is something like:
code:
git checkout other-branch
# merge master into this branch and throw away the changes
git merge -s ours master
# fiddle the branch heads so it looks like this branch got merged into master instead
git branch -f master
git reset --hard HEAD^
Apparently the 'theirs' merge strategy was removed because they don't like that workflow. If you want to keep that unused history you're supposed to stick it in a different branch: http://marc.info/?l=git&m=121637513604413&w=2

But if you want to do it anyway, how about this for a workaround:
code:
git checkout master
git merge --no-commit other-branch
git checkout other-branch . #blow away all differences
git commit

Dylan16807
May 12, 2010

ExcessBLarg! posted:

As I understand modern Windows has support for symlinks, although making use of them with git requires effort.
That answer uses hard links to pretend to be symlinks, which is really fragile. Windows does technically have symlinks but you can't make them as a limited user, so git hasn't really bothered adding support.

Dylan16807
May 12, 2010

HardDisk posted:

I'm looking for a specific git tutorial where the author tries to illustrate git operations with actual files and folders. For example, each commit, the author copied the entire repository to a new folder, where then he explains that it is unsustainable and started copying only the changes and so on.

Does it ring a bell for anyone?

That sounds like a weird way to start, since at a logical level git works with full snapshots and not changesets.

Then it deduplicates entire files, and sometimes compresses them together, but that gives a significantly different output from copying changes as changes.

Dylan16807 fucked around with this message at 19:33 on Aug 9, 2015

Dylan16807
May 12, 2010
Are https://xxxxxx@bitbucket.org/zzzzz/yyyyyyy.git and origin the same place? Why are you passing a full url to push?

Dylan16807
May 12, 2010

Arcsech posted:

Yeah, you can get the original back, which is great. But my original point was that if you don't know what you're doing (see: team that has never used any form of version control), unfucking a bad rebase is not the easiest thing ever, and even if you do know what you're doing, the commands are kind of arcane. Better to just use a simpler tool that won't let them shoot themselves in the foot (as easily), given the state of the team in question.

Though it's comforting to know that worst-case you can unfuck things without any commands at all. Open the reflog in a text editor, find the ID from before you broke it, copy into branch file.

Dylan16807
May 12, 2010

New Yorp New Yorp posted:

In vanilla Git? No. Are you using a service that hosts repos? If not, start, they all allow that.
Isn't the vanilla git answer putting some code in .git/hooks/update?

Dylan16807
May 12, 2010
~1, ~2, ~3 mean parent, grandparent, great-grandparent, etc.

But commits can have more than one parent, like when you're merging. ~ always picks the first parent.

^1, ^2, ^3 mean first parent of this commit, second parent of this commit, third parent of this commit, etc.

So they are only the same when the number is exactly 1.

And if you omit the number then it assumes 1.

Dylan16807
May 12, 2010
Chrome is slowly rolling out a feature that lets you embed text in a link, and the browser will automatically scroll to that text and highlight it. So your problem might be solved soon, if other browsers adopt it.

Adbot
ADBOT LOVES YOU

Dylan16807
May 12, 2010
I want to directly note here that git can also push and pull to a shared directory.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply