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
netcat
Apr 29, 2008
Anyone a gerrit expert? I'm trying to enable force push rights for myself (I'm an admin) so I can delete remote branches and tags but gerrit -refuses- to let me do it, even though I've ticked the "force push" box in every place I could find it.

Adbot
ADBOT LOVES YOU

Linear Zoetrope
Nov 28, 2011

A hero must cook
I'm sure this is pretty straightforward for people used to large scale git, but I've mostly used it for small open source stuff I've been a primary author on.

There are essentially three actors here:

1. The master repository we're working with
2. My coworker's work, that I'll need to depend on
3. My own work

With respect to 3, there are essentially two types of branches here: features and enhancements that need to be in their own branch as they may be proposed and merged into the master repo (1), and my own internal changes to the libraries for my personal work. This means that I essentially need my own branch off master that merges all my features, and the features of my coworker, and contains my personal changes, and I'm wondering what the easiest structure to do this is. What I'm primarily worried about is avoiding having to detangle a merge/rebase conflict rat's nest where I merge feature A into my branch, and later it's merged into master and I want to remerge or rebase my work on master for new features. Is my best option here just to do it the straightforward way and do an interactive rebase to manually ignore merges my internal branch has already seen when I need to sync up with the master branch?

Stringent
Dec 22, 2004


image text goes here

Linear Zoetrope posted:

I'm sure this is pretty straightforward for people used to large scale git, but I've mostly used it for small open source stuff I've been a primary author on.

There are essentially three actors here:

1. The master repository we're working with
2. My coworker's work, that I'll need to depend on
3. My own work

With respect to 3, there are essentially two types of branches here: features and enhancements that need to be in their own branch as they may be proposed and merged into the master repo (1), and my own internal changes to the libraries for my personal work. This means that I essentially need my own branch off master that merges all my features, and the features of my coworker, and contains my personal changes, and I'm wondering what the easiest structure to do this is. What I'm primarily worried about is avoiding having to detangle a merge/rebase conflict rat's nest where I merge feature A into my branch, and later it's merged into master and I want to remerge or rebase my work on master for new features. Is my best option here just to do it the straightforward way and do an interactive rebase to manually ignore merges my internal branch has already seen when I need to sync up with the master branch?

I'd create a new branch off of master and cherry-pick the commits I wanted from my development branch and create a pull request for that.

Coffee Mugshot
Jun 26, 2010

by Lowtax

netcat posted:

Anyone a gerrit expert? I'm trying to enable force push rights for myself (I'm an admin) so I can delete remote branches and tags but gerrit -refuses- to let me do it, even though I've ticked the "force push" box in every place I could find it.

Not a gerrit expert, but I would imagine that you're missing some configuration/token that allows you to locally perform force pushes against your gerrit instance. The gerrit UI doesn't change what commands git issues locally. If I'm misunderstanding your question, please post some error you get when trying to force commit.

boo_radley
Dec 30, 2005

Politeness costs nothing

Coffee Mugshot posted:

Not a gerrit expert, but I would imagine that you're missing some configuration/token that allows you to locally perform force pushes against your gerrit instance. The gerrit UI doesn't change what commands git issues locally. If I'm misunderstanding your question, please post some error you get when trying to force commit.

Yeah, I'd make sure that you have the ability to force push straight on the command line before doing anything in gerrit.

ufarn
May 30, 2009
Can someone walk me through git stash, because I obviously don't want to end up losing the stash?

What do I do to create a stash? For specific files.
What do I do to retrieve it?
What do I do to add more stuff to it?

How do multiple, separate stashes work?

ufarn fucked around with this message at 01:04 on Sep 5, 2017

ToxicFrog
Apr 26, 2008


ufarn posted:

Can someone walk me through git stash, because I obviously don't want to end up losing the stash?

It's really hard to lose the stash. Don't use git stash drop or git stash pop and it's not going anywhere.

quote:

What do I do to create a stash?
What do I do to retrieve it?

git stash or git stash save <description> to create one and git stash apply or git stash pop to retrieve it -- this is in the first page of git help stash. :cmon:

quote:

For specific files.

This isn't directly supported, but you can fake it by staging the files you don't want to stash and then using git stash save --keep-index. You can also use git stash save --patch to interactively select individual diff hunks to stash.

quote:

What do I do to add more stuff to it?

You don't, although you can create more stashes.

quote:

How do multiple, separate stashes work?

They're recorded in the reflog of their own sort of "pseudo-branch" called stash; git stash list will list them and you can refer to them by index.

Gounads
Mar 13, 2013

Where am I?
How did I get here?

ufarn posted:

Can someone walk me through git stash, because I obviously don't want to end up losing the stash?

What do I do to create a stash? For specific files.
What do I do to retrieve it?
What do I do to add more stuff to it?

How do multiple, separate stashes work?

What exactly are you trying to do? From #3/#4, It kinda sounds like you should just make a branch and work on it.

ufarn
May 30, 2009
I have main project with all sorts of things. I can't branch off, because I'll need to commit everything, and I just want to stow away some stuff that's cluttering my git status without adding it to .gitignore. The stuff cluttering things is mainly confined to one or two folders.

raminasi
Jan 25, 2005

a last drink with no ice

ufarn posted:

I have main project with all sorts of things. I can't branch off, because I'll need to commit everything,

One of us is misunderstanding something. Why does the latter preclude the former?

Coffee Mugshot
Jun 26, 2010

by Lowtax

ufarn posted:

I have main project with all sorts of things. I can't branch off, because I'll need to commit everything, and I just want to stow away some stuff that's cluttering my git status without adding it to .gitignore. The stuff cluttering things is mainly confined to one or two folders.

You could make a branch that has your clutter on it and another branch that is hard reset to the correct HEAD, for example, which might as well be a stash in some way. However, if it really is a couple of directories you're trying to ignore, you should just add it to .gitignore. I mean, if you're really desperate, you could always hardcode those paths into core.excludesFile. Based on what you said so far, .gitignore sounds like the only reasonable thing to do here. It doesn't sound like you even care about the content you want to stash/branch off.

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


In Git parlance (or hell in other VC software) is a Pull Request anything other than a formal way of saying "here's the changes I wanna merge into master/dev/whatever, everyone cool with that"?

Data Graham
Dec 28, 2009

📈📊🍪😋



It's you (a third party contributor) requesting that the owner of the code pull your changes into the trunk.



E: sometimes you and they are the same person.

chippy
Aug 16, 2006

OK I DON'T GET IT
I encourage regular rebasing in my team for bringing long-lived feature branches up-to-date with master/develop branches that have moved on a lot. I've got one or two devs in the team who seem to have consistent trouble with rebases, they take absolutely forever to do, and encounter two problems frequently:

1. 'Conflicts' in files that no one else has touched. For example. Foo.cs has only been edited on the feature branch. Dev is trying to rebase the feature branch on master. Git marks Foo.cs as conflicted, bringing it up in a merge tool like VS will show the 2 versions of the file - the one from master and the one from the feature branch, even though no-one's actually committed any changes to that file on the master branch.

2. Same conflicts coming up repeatedly. Dev will mark a conflict as resolved, rebase will play through a few more commits, then suddenly the same conflict will pop up again.

Whenever I babysit them through the rebase from the beginning, things seem to go fine, but I generally get called in to help half way through when they are seeing a lot of these types of issues, and I'm not 100% sure how they got there.

Does anyone know what they might be doing to get themselves into these sort of messes? I use rebase regularly and never seem to have problems like this.

I realise this is a bit of a vague question and I wish I could give more detail, but I'm a bit confused myself.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Not sure what's happening in 1), but for 2), you can tell git to "re-use recorded resolutions."

code:
$ git config --global rerere.enabled true
This creates a local cache of how you've resolved hunk conflicts, which should reduce the number of times you have to fix the "same" merge.

chippy
Aug 16, 2006

OK I DON'T GET IT
Urgh, I think I know what it is. I think the situation has been created by them doing a pull at the end of the rebase (because the remote branch now shows as diverged), instead of a force push*. Then, when they rebase the branch again, they started running into these types of problems. This is my working theory, anyway.

* I know it's kind of sketchy rebasing branches that are pushed to a remote, but we always push to our remote at the end of the day so we've got an off-site backup, even for our own local feature branches. I've advised them never to do any of this on shared branches.

Xerophyte
Mar 17, 2008

This space intentionally left blank

chippy posted:

Urgh, I think I know what it is. I think the situation has been created by them doing a pull at the end of the rebase (because the remote branch now shows as diverged), instead of a force push*. Then, when they rebase the branch again, they started running into these types of problems. This is my working theory, anyway.

Probably, yeah. Typical scenario:
- End of work, time to push. git push -f
- New day, time to rebase. git rebase origin/master
- Hmm, git says my branch is out of date with its tracking branch and I should pull to update. git pull
- Oh, master is updated again. git rebase origin/master
and then suffering.

FWIW, we encourage the same approach of rebase and force-push on personal branches. I think it's a fine workflow, but it also makes git pull a big footgun when you're on one of those branches. I generally ask junior engineers to get a GUI with a nice log view, because even mild history editing like git rebase benefits from being able to actually see the history. Merges are a lot more lenient.

ChickenWing
Jul 22, 2010

:v:

Xerophyte posted:

- End of work, time to push. git push -f
- New day, time to rebase. git rebase origin/master
- Hmm, git says my branch is out of date with its tracking branch and I should pull to update. git pull
- Oh, master is updated again. git rebase origin/master
and then suffering.

:shepface:

ChickenWing
Jul 22, 2010

:v:

what the fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuck kind of workflow includes force pushes as a regular occurrence

Less Fat Luke
May 23, 2003

Exciting Lemon

ChickenWing posted:

what the fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuck kind of workflow includes force pushes as a regular occurrence
Ones using their own feature branch that frequently rebase from master.

Edit: though --force-with-lease is a nice safety.

Less Fat Luke fucked around with this message at 13:53 on Sep 15, 2017

Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today
+1 to rebasing and force-pushing personal branches. It's not like there's actually any danger (with a lease). You can always pull out the reflog, and in the unlikely event that someone else is defying best practices and trying to track your branch, they can clearly see what happened and rebase their own work in turn.

Volguus
Mar 3, 2009

Ralith posted:

+1 to rebasing and force-pushing personal branches. It's not like there's actually any danger (with a lease). You can always pull out the reflog, and in the unlikely event that someone else is defying best practices and trying to track your branch, they can clearly see what happened and rebase their own work in turn.

That's some next level obsessive compulsive disorder. Going out of one's way just to ... see a straight line. The kind of line that nobody ever will look at, because it is irrelevant. But yes, as long as you keep your fetishes in personal branches, it's ok.

Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today

Volguus posted:

That's some next level obsessive compulsive disorder. Going out of one's way just to ... see a straight line. The kind of line that nobody ever will look at, because it is irrelevant. But yes, as long as you keep your fetishes in personal branches, it's ok.
I'd like to try a merge-only workflow sometime, but so far everywhere I've worked has preferred linearity :shrug:

Less Fat Luke
May 23, 2003

Exciting Lemon

Volguus posted:

That's some next level obsessive compulsive disorder. Going out of one's way just to ... see a straight line. The kind of line that nobody ever will look at, because it is irrelevant. But yes, as long as you keep your fetishes in personal branches, it's ok.
I think that the flow we're describing is literally the post popular one used with GitHub now, normally named GitHub flow, and is a lot nicer than having a ton of merge commits in your branch (since changes can sneak in during merges with conflict resolution).

It's not about OCD or a fetish at all, it's just replaying your changes on top of the newer master and resolving changes that way instead of through merges.

Volguus
Mar 3, 2009

Ralith posted:

I'd like to try a merge-only workflow sometime, but so far everywhere I've worked has preferred linearity :shrug:

Yea, I cannot claim that I understand this ... preference, since well ... from where I sit, i don't give a poo poo if it's the spaghetti monster in there, since i don't look at that. I think I saw a picture of the git branch tree once or twice in my life.
Branch or tag v1.2.3 is release 1.2.3. Development happens in the dev/development/devel branch from where things can be merged or cherrypicked into release branches if need be. From master releases are made (tag or branch, but is so much simpler to just branch) and everyone is happy. why wouldn't they be? When the number of branches exceeds some arbitrary number (10, 20, 100?) some can be deleted. The last thing in the world that I want is to babysit a version control repository. And the only time I ever had to unfuck a git repo was when someone hosed it by using force (of course, not in their personal branches).

ChickenWing
Jul 22, 2010

:v:

Volguus posted:

But yes, as long as you keep your fetishes in personal branches, it's ok.

The Something Awful Forums > Discussion > Serious Hardware / Software Crap > The Cavern of COBOL > Version Control Questions Megathread: No Graph Shaming

Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today
There's something to be said for keeping master's history concise and readable for auditing purposes, but that's really more about squashing commits than anything.

Volguus
Mar 3, 2009

Ralith posted:

There's something to be said for keeping master's history concise and readable for auditing purposes, but that's really more about squashing commits than anything.

Squashing commits, yes, totally. You don't want (if you can help it) "wip did something, doesn't work" kind of commits in master or devel, which are unavoidable during normal workday. But in their own branch ... is perfect for tracking when exactly bug 55 was introduced.

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


Am I crazy, or is there no way to fetch or push git tags through VS2015? You have to use the command line?

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Commits in your feature branch and commits in your pull request serve two different purposes: one is just for getting something done, the other is for explaining what was gotten done.

Sometimes they're the same, but I rebase extensively and I find that if nothing else, I'll rewrite the commit messages from being one-line notes to self.

chutwig
May 28, 2001

BURLAP SATCHEL OF CRACKERJACKS

Doc Hawkins posted:

Commits in your feature branch and commits in your pull request serve two different purposes: one is just for getting something done, the other is for explaining what was gotten done.

Sometimes they're the same, but I rebase extensively and I find that if nothing else, I'll rewrite the commit messages from being one-line notes to self.

code:
WIP
WIP
WIP
WIP
what is this shitwhat is going on
WIP
WIP
WIP
fixed it
fixed it again
fixed it for real this time
fixed
WIP
fixed
I usually push all sorts of garbage commit messages onto feature branches and then rewrite it into a single commit with a real message before the PR. If it's particularly large I might checkpoint occasionally by rewriting all the WIP commits into a real commit and then return to making more WIP commits, but usually if that's happening I'm probably already knee-deep in dreadful scope creep and the feature branch has gotten way bigger than it should be.

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!
I want to include someone else's repository in my repository because they have some scripts and things that I can re-use specifically for this project. Quick searching tells me that git submodules are what I want for this. I also need to modify some of his scripts with different options or different things. What is the best way to do this?

Thinking about it, the options I came up with are

1. Fork his repository, make a new branch, do my edits in there, and add this specific branch into my repository as a submodule (in "external" or "contrib" for example).
2. Add his repository to my repository as a submodule but do not modify it at all. Create a patch file that I will track in my repository, and use that patch file to create modified versions of his scripts that I'll use.

In both cases I'll theoretically be able to keep the scripts updated against his main repository/releases but still have my own modifications but I'm not sure what is the standard way of doing this.

raminasi
Jan 25, 2005

a last drink with no ice

Volguus posted:

Yea, I cannot claim that I understand this ... preference, since well ... from where I sit, i don't give a poo poo if it's the spaghetti monster in there, since i don't look at that. I think I saw a picture of the git branch tree once or twice in my life.

Some of us visualize the graph regularly! :shobon:

Volguus
Mar 3, 2009

raminasi posted:

Some of us visualize the graph regularly! :shobon:

Are you a developer or an integrator? As a person who puts builds together for release, i can see that happening, of course. As a developer ... there isn't anything in there of value..

Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today

Boris Galerkin posted:

I want to include someone else's repository in my repository because they have some scripts and things that I can re-use specifically for this project. Quick searching tells me that git submodules are what I want for this. I also need to modify some of his scripts with different options or different things. What is the best way to do this?

Thinking about it, the options I came up with are

1. Fork his repository, make a new branch, do my edits in there, and add this specific branch into my repository as a submodule (in "external" or "contrib" for example).
2. Add his repository to my repository as a submodule but do not modify it at all. Create a patch file that I will track in my repository, and use that patch file to create modified versions of his scripts that I'll use.

In both cases I'll theoretically be able to keep the scripts updated against his main repository/releases but still have my own modifications but I'm not sure what is the standard way of doing this.

1 will be much easier to keep up to date with upstream, and easier to push changes to upstream from.

smackfu
Jun 7, 2004

How bad is it to push a large unchanging binary into git? Like a 1 gb database image. I know it's not meant for it but it's our easiest way to share files.

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


smackfu posted:

How bad is it to push a large unchanging binary into git? Like a 1 gb database image. I know it's not meant for it but it's our easiest way to share files.

It's not really bad per se, it's just not very efficiently compressed. But if it never changes it'll just make the first clone/pull/push/whatever take longer.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Could you serve the file from a secure url and just share a post-checkout hook that ensures it's downloaded?

E: that might not work, I'm not a hook expert, but pretend I said "share a script"

Doc Hawkins fucked around with this message at 00:27 on Sep 17, 2017

ufarn
May 30, 2009

smackfu posted:

How bad is it to push a large unchanging binary into git? Like a 1 gb database image. I know it's not meant for it but it's our easiest way to share files.
I don't know what testing envs you have, but sounds like something for Git LFS.

Didn't Facebook end up with Mercurial because Git couldn't handle their large GBs of code base or something?

Adbot
ADBOT LOVES YOU

Volguus
Mar 3, 2009
It's no longer applicable anymore (maybe?) but many years ago (2008-9 maybe) a coworker pushed to git a 3GB binary file. The push went fine. The pull ... not so fine. We were on windows 32 bit at the time and git would try to load that entire 3GB file in memory and it would obviously die a very painful death when windows decided that you had enough(2gb i think was the limit per process). Other pushes with 1KB file to overwrite it were failing and since none of us had any idea what to do (very noobs in git) we just nuked the git repo and started from scratch. Since then I have an aversion towards large binary files pushed to a version control repository.

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