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
Vanadium
Jan 8, 2005

I just spent an hour and a half using hg-git and git's post-receive hook to let me push to hg-git's internal git repository and automatically have that do hg-git's pull and then hg-push the changes to our central mercurial repository! Now I can pretend that mercurial does not even exist and just use git! At least until someone else pushes something into the repository and I get conflicts. :unsmith:

Adbot
ADBOT LOVES YOU

Vanadium
Jan 8, 2005

It is a hobby thing that I was only going to contribute to sporadically and I kind of wanted to avoid spending half of the time trying to figure out how hg is different from git. In retrospect, that was pretty silly.

Vanadium
Jan 8, 2005

Triple Tech posted:

git = good for decentralized; good for merging
svn = good for centralized; windows integration via tortoise; good for naive merging

I would recommend SVN if your case.

What makes git worse for centralized than svn?

Vanadium
Jan 8, 2005

What does branching/merging look like in hg compared to git? I am tracking a hg repository in git using hg-git and slightly confused!

Vanadium
Jan 8, 2005

Either way you are going to end up with a merge commit that removes all the old files and adds all the new files, why not just make it a separate project :(

Vanadium fucked around with this message at 14:50 on May 27, 2010

Vanadium
Jan 8, 2005

The closest I can think of is to maintain a separate copy of the repository, use rebase --interactive to squash all but the commits you want to keep, and synch that with your complete repository manually.

Vanadium
Jan 8, 2005

git rebase --interactive commit-before-your-branch and read the instructions that show

This is destructive since it rewrites history so I guess you may want to duplicate your branch before trying.

Vanadium fucked around with this message at 17:29 on Jun 29, 2010

Vanadium
Jan 8, 2005

Ah, I have not used the reflog apart from digging through it manually. I did not realise it counted as anything but an implementation detail. :shobon:

Vanadium
Jan 8, 2005

I only ran into the reflog because git would not gc some multi-gb objects that were checked in at one point but since dropped through history rewriting, welp.

Vanadium
Jan 8, 2005

Janin posted:

I use Bazaar for pretty much everything; it's nice because it's in Python, so there's a real API instead of just bashing everything together with thousands of lines of shell scripts. This advantage also applies to Mercurial.

There's Dulwich, a "a pure-Python implementation of the Git file formats and protocols", but I have no idea whether it is any good. :shobon:

Vanadium
Jan 8, 2005

Why the hell does git push someremote somebranch cause origin/somebranch to get updated when origin isn't someremote?

Vanadium
Jan 8, 2005

Deus Rex posted:

Is somebranch tracking origin/somebranch?

Yeah

Vanadium
Jan 8, 2005

Can you use that sort of thing to change the initial commit of a git repos? I've not gotten that to work in the past but I wasn't using github's instructions either.

Vanadium
Jan 8, 2005

Is there a cool way in git to keep around build artifacts on, like, a per-branch basis so that I can switch between branches without having to rebuild everything every time? Do I just keep around multiple working copies of the same repository?

Vanadium
Jan 8, 2005

My problem is that switching branches touches files so make wants to rebuild everything. So if I work on one branch, then check out another and build that even in another build dir, and switch back to the first branch, I "need" to rebuild everything that's different in the second branch.

That link seems to address that problem, cheers.

Vanadium
Jan 8, 2005

Each commit knows it parent(s). Given a commit you can always follow the ancestry chain upwards.

Vanadium
Jan 8, 2005

Let's post a kickstarter to build a decent commandline interface to git on top of libgit2 or w/e :f5:

Vanadium
Jan 8, 2005

Deus Rex posted:

Most of the ways git gives you to shoot yourself in the foot you can recover completely from, one exception being like reset --hard. The reflog is your friend.

reset --hard is hardly worse than checkout . though, which sounds a lot more innocent.

Vanadium
Jan 8, 2005

HFX posted:

I'm not sure what you are talking about with checkout. If you have uncommited changes it won't do it without a warning about overwriting files. If you have files you have not yet added, it will warn you about those too.

I mean git checkout <path> where <path> is the current directory or w/e, which just throws away all unadded changes in <path> by overwriting them with the state of the index with no warning. That's also really the destructive thing that git reset --hard does, the bit where it makes the current branch point somewhere else is comparatively easy to undo.

Vanadium
Jan 8, 2005

ToxicFrog posted:

Ha ha ha ha ha ha ha ha ha ha :suicide:

No, this is not a bug. As much as I like git, its UI is an inconsistent trainwreck and "git checkout" meaning both "switch to a different branch or commit (and abort if this can't be done safely" and "'check out' specific versions of files into the working tree, obliterating whatever is already there without confirmation" depending on how it's invoked is entirely deliberate. gently caress knows why.

git checkout master will switch branch to master (and check out its contents into the working tree) if and only if this can be done without losing untracked files/changes.

git checkout -- . will nuke your entire working tree instantly and without confirmation, equivalent to git reset --hard HEAD.

Yeah I'm pretty sure it's not a bug either. The way I've come to rationalize it is that the "core functionality" of git checkout is to copy state in the direction of the committed history towards the working copy, and while setting HEAD to another branch might be where it got its name from, that's really just an incidental detail...

Vanadium
Jan 8, 2005

KoRMaK posted:

I'm rebasing a branch, and I want a kind of specific behavior which seems available but I'm not completely sure.

I'm doing the following: git rebase -i

Then I edit the commits from 'pick' to 'edit'

What I'd like to happen is that each commit that is going to be commited paused before its commited but while it's staged. It seems to only be stopping at the staging process if there's a conflict. How do I get it to pause so I can view whats being added before I commit?

e: Hmm it seems like this might work git reset --soft HEAD^

The idea seems to be that you just let the rebase process commit everything in the revision you want to edit, and then you adjust it with git commit --amend. With your git reset --soft, you'll basically lose out on the commit message when you finally decide to commit and otherwise the workflow would be the same as if you were amending, afaict?

Vanadium
Jan 8, 2005

You could probably convert your hg work into a fresh git history, use git format-patch to turn the new commits that don't have equivalents on github into series of patches, then switch to the github history and use git am to apply the patches as commits again.

Afterwards you can probably use hg-git all over again to convert the git history into a hg repos so you can keep working with hg, though that'd break your bitbucket history. I don't know enough about hg to figure out how that mapfile stuff would work

(For (1) you could also force-push your new git history to your existing github repostiory, that way you won't lose the stars or followers or whatever, but everybody will now have the problem you're having right now so it's a bad idea.)

Vanadium
Jan 8, 2005

How much effort would it be to set up a no-op ssh tunnel when you're local? :v:

Vanadium
Jan 8, 2005

You can set up a clean branch from origin's master, and use git cherry-pick to grab a single commit (or a range of commits) from the branch you've worked on. Git will duplicate that commit as if the same changes had been made on top of the clean branch, with the same commit message and all.

Vanadium
Jan 8, 2005

I've been tracking a generated file in git for a while and noticed that the contents are basically unordered, and it gets generated in a seemingly random order every time, making diffs pretty bad to look at. I've looked at clean/smudge filters to just sort it arbitrarily but consistently on checkin, but I can't really figure out how to not make it freak out about unsaved changes every time I look at a commit that predates me adding those filters.

Is there a decent way to deal with that short of running a git filter-branch to rewrite history so I will always have been using that filter?

Vanadium
Jan 8, 2005

How do y'all feel about history-rewriting on published feature branches? I feel as long as it's obviously my personal feature branch it's cool to do whatever to the history even though it's technically public, but I guess it gets iffy when someone else shows up and wants to work on the same thing.

Vanadium
Jan 8, 2005

git reset moves the branch pointer to the given commit, so the new contents of the branch is all the commits reachable from that commit, dates don't really play into it. I'm not sure what you mean by topology vs ancestry, I thought ancestry defines the topology.

But if you're already published the current state of the branch, it's really bad form to try to rewrite history. You'd want to use git revert to undo specific commits/merges by introducing more commits. I think that might become super messy.

I'm not sure if git blame would be helpful to find out when certain changes appeared in your branch, I assume it will point to the original commits and not the merge commits, but I don't know from the top of my head.

It's not always obvious from glancing at git log what commits are reachable from the branch head, showing the history so linearly is kinda misleading when there's merges involved. I dunno what fisheye is exactly, have you used tools that visualize the history as a graph, so you can just trace all the lines and see where they go?

Vanadium
Jan 8, 2005

Can't you do all the splitting while maintaining history fairly easily in git with, like, the subtree stuff or just some filter-branch work and some patience? I mean that'd be my preference because I don't know any svn.

Vanadium
Jan 8, 2005

Has anyone played around with pijul. I keep meaning to but then spending my free time on videogames or organizing my email instead.

Vanadium fucked around with this message at 08:02 on Mar 27, 2017

Vanadium
Jan 8, 2005

As many branches as possible imo.

Vanadium
Jan 8, 2005

I tend to just replace my fork's master with an orphan commit that just says "hi I'm a repo for feature branches" in the readme, but I'm weird like that.

Vanadium
Jan 8, 2005

Ralith posted:

The github UI is pretty good at communicating what's a fork and what's the upstream repo without any effort on your part. To the point where it's kind of obnoxious to manage the (rare) case where that relationship needs to change.

I guess I just don't enjoy having this inert, frozen-in-time branch that everybody lands on by default when people click my fork. It can only confuse people.

Vanadium
Jan 8, 2005

wolffenstein posted:

You can change which branch is displayed by default in your repo's GitHub settings.

But there isn't any branch it should display! It's just a bunch of random WIP branches or whatever. Why should one be distinguished from the others?

Vanadium
Jan 8, 2005

I always pull and expect it to do a ff-merge, or reset --hard origin/foo. :shobon:

Vanadium
Jan 8, 2005

The notion that it's ok for my history to look like poo poo because it's some other nerd's job to untangle it later is honestly kinda mystifying to me

Vanadium
Jan 8, 2005

keybase also has a private git repo feature, probably so people stop putting git repos directly on their encrypted distributed file system. I'm not sure how awkward it gets if you want to share the repo with someone eventually, but at least it's gonna be hella encrypted.

Vanadium
Jan 8, 2005

Put the repo somewhere else and have the big dir symlink into it for the few files you care about.

Vanadium
Jan 8, 2005

Aren't both of these the same operation / will run into the same merge conflicts? Maybe you can mitigate the pain with git rerere but in principle you're starting with A and sequentially applying a subset of B either way, no?

Adbot
ADBOT LOVES YOU

Vanadium
Jan 8, 2005

Tequila Bob posted:

Learning Git isn't the easiest thing in the world, but there are two reasons you should:

1. It will pay dividends throughout your entire career of software development

2. You only have to learn it once. It's not like learning a programming language that gets new features every couple of years; learn Git once, know it forever. At least, that's been my experience.

I bet that's what they told people about why to learn svn.

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