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
Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do
But Google puts everything in one repo!

Adbot
ADBOT LOVES YOU

necrotic
Aug 2, 2005
I owe my brother big time for this!

Thermopyle posted:

Why are they in the same repository at all?

If they all unrelated this is the correct way.

Axiem posted:

But Google puts everything in one repo!

Yeah, because they are all intertwined. My last job had a bunch of lovely microservices that all dependend on each other in separate repos and adding new features across them was the worst.

boo_radley
Dec 30, 2005

Politeness costs nothing
Agreed with everything else that's been mentioned. If there's no dependencies between your three projects, split them out into their own repos. It'll be easier to dev and deploy as time goes on.

ToxicFrog
Apr 26, 2008


Axiem posted:

But Google puts everything in one repo!

Google also has a shitload of extra infrastructure and tooling (including, y'know, a custom version control system) that lets that work for them.

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do
:thejoke:

huhu
Feb 24, 2006
Unfortunately, it's not my Git repo to decide the structure.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

huhu posted:

Unfortunately, it's not my Git repo to decide the structure.

I wonder about the feasibility of using your own repo structure locally and then just drop your changes into their weirdass repo when you're ready to deploy...

necrotic
Aug 2, 2005
I owe my brother big time for this!
Should be relatively straight forward with subtrees: https://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging

boo_radley
Dec 30, 2005

Politeness costs nothing

necrotic posted:

Should be relatively straight forward with subtrees: https://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging

Are subtrees the new sub-modules? I've never heard of those before

necrotic
Aug 2, 2005
I owe my brother big time for this!
Not new in the direct sense, but a replacement yes. The previous chapter of that book tries to do the same thing with submodules as a setup for the subtree chapter.

smackfu
Jun 7, 2004

So, I understand in theory that git is decentralized version control. But practically, if our git server is down, how do I share a commit or branch with someone else on my team?

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

smackfu posted:

So, I understand in theory that git is decentralized version control. But practically, if our git server is down, how do I share a commit or branch with someone else on my team?

Clone your repo to a shared network folder or open a private gitlab.com account (whichever is more convenient) and set it as a remote repo for both of you.

Hughlander
May 11, 2005

smackfu posted:

So, I understand in theory that git is decentralized version control. But practically, if our git server is down, how do I share a commit or branch with someone else on my team?

git remote add yourteammate user@yourteammate.local:/path/to/their/repo
git fetch yourteammate
git push yourteammate master


'origin' is just mutually agreed upon name for the first remote. But there's nothing magical about it or any other remote.

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 just signed up for a Bitbucket account to submit a bug to a thing I use and I'm actually liking the interface a lot more than Github. I added 2FA which meant I had to add a secondary email so I put my university one and now apparently I have been upgraded to an Academic plan which from what I can tell is a paid plan but free and without the restrictions of a free plan.

Is there any compelling reason to choose Github over Bitbucket? A lot of my repositories are private ones that I don't want shared (research notes, things I'm working on right now for my phd, random side projects I don't wanna release, etc). From a quick search it seems people say to use Bitbucket for private repositories, but I get unlimited private repos on github as well.

It looks like Bitbucket gives you more tools like Pipelines/CI that should "just work" for private repositories or am I missing something? These things sound neat and might be something I wanna play around with.

Git lab is out of the question because their UI is atrocious.

Gounads
Mar 13, 2013

Where am I?
How did I get here?
Not really. Bitbucket is fine and good and there's no reason to not use it if you like it.

I like Github's PR/Code Review mechanisms better. Github pages is cool. Github has a similar free program
https://education.github.com/pack

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!
How do I import a private Github repo into Bitbucket without giving Bitbucket my GitHub username and password? It seems really weird that Bitbucket is asking for the password to another service and I refuse to give them that just on principal.

Fake edit: this is from the Bitbucket "import from other repository" page.

I presume that instead of doing this I could just make a new repo on Bitbucket and push the old repo to it but would that result in any loss of history?

Gul Banana
Nov 28, 2003

it would not. all history is stored in the repo

B-Nasty
May 25, 2005

For Github -> Bitbucket, you should be able to use a Github Personal Access Token, which is more like an API key. You can then kill this key after import.

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 just created a new empty repository on Bitbucket and pushed my local branch(s) to it. Works fine and all the history is there but there are no issues or tags.

The tags part I think is just cause I didn't/forgot to push up the tags so that's whatever. But what about issues? I always thought that issues were like a standardized thing in the git spec but now I'm reading about them and I guess they're not?

I've found some ways to migrate them through searching but I really can't be bothered too much about them, for my use case I mean.

B-Nasty posted:

For Github -> Bitbucket, you should be able to use a Github Personal Access Token, which is more like an API key. You can then kill this key after import.

Could that have been used to generate a one use password I could have given to Bitbucket? The page was specifically asking for a username and password so I didn't think about the personal access tokens cause I thought they gave you just a token you'd use in place of a username/password combo.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Boris Galerkin posted:

The tags part I think is just cause I didn't/forgot to push up the tags so that's whatever. But what about issues? I always thought that issues were like a standardized thing in the git spec but now I'm reading about them and I guess they're not?

They sure aren't. Git is a revision control system. That's it.

Hughlander
May 11, 2005

New Yorp New Yorp posted:

They sure aren't. Git is a revision control system. That's it.

To be fair though notes don't fit into being a revision control system and that's it.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

https://blogs.msdn.microsoft.com/bharry/2017/05/24/the-largest-git-repo-on-the-planet/

quote:

Windows is live on Git

Over the past 3 months, we have largely completed the rollout of Git/GVFS to the Windows team at Microsoft.

As a refresher, the Windows code base is approximately 3.5M files and, when checked in to a Git repo, results in a repo of about 300GB. Further, the Windows team is about 4,000 engineers and the engineering system produces 1,760 daily “lab builds” across 440 branches in addition to thousands of pull request validation builds.

venutolo
Jun 4, 2003

Dinosaur Gum
I have recently jumped on a project that uses Git and other people have put files particular to them (such as configuration files particular to their needs) in the project root directory. I want to clean this up and remove them from the repo. However, if possible, I would like to avoid the situation where they do a pull and their local copies of those files get removed from disk. I don't know if this is possible and kind of doubting it.

I know locally I can run 'git rm --cached some.file' and it will remove the file from the repo, but keep my local file on disk. Is there a way to effectively do something similar when someone else pulls the repo where they still keep their local copy of the file which is no longer a part of the repo?

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer
I'm thinking there should be some way to do what you're wanting to do by adding those files to the .gitignore file. But I'm​ not sure what the interaction is if they don't have the updated gitignore before they pull the changes that remove the files...

necrotic
Aug 2, 2005
I owe my brother big time for this!
They'll have to copy the file somewhere else locally beforehand, or use something like this after pulling down your commit:

code:
git show SHA_WITH_FILES_STILL_EXISTING:path/to/the/dumb/file > path/to/the/dumb/file

Snak posted:

I'm thinking there should be some way to do what you're wanting to do by adding those files to the .gitignore file. But I'm​ not sure what the interaction is if they don't have the updated gitignore before they pull the changes that remove the files...

.gitignore only matters for adding files to your stage. If you ignore a file already in the tree it will prevent adding changes to the file without the force flag. It won't help for what he wants (although those files should 100% be added to the gitignore so it doesn't happen again).

venutolo
Jun 4, 2003

Dinosaur Gum

necrotic posted:

They'll have to copy the file somewhere else locally beforehand, or use something like this after pulling down your commit:

Yeah, I figured there wasn't a way to do it exactly as I wanted and they'd need to fetch the file from some previous repo state. I was hoping to avoid that because I'm sure someone is going to whine.

necrotic
Aug 2, 2005
I owe my brother big time for this!
Change the file to some ridiculous settings so they see the problem with it as is.

Paul MaudDib
May 3, 2006

TEAM NVIDIA:
FORUM POLICE
is this really the best way to get git-diff to ignore whitespace globally?

how is there not a generic "diff argument" setting?

necrotic
Aug 2, 2005
I owe my brother big time for this!
edit: nevermind, that was not what I thought it was! Yeah, that's dumb.

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 have all my dotfiles in a public git repo except for my ssh/.config file just cause it has random IP addresses (and usernames) for machines I use.

Is there a way I could transparently encrypt this one file so that I can just throw it into the same dotfiles repo I have so I don't have to clone two of them on a new setup?

I don't think it's necessarily damaging or bad that I'd store those IP address in a public repo in plain text since I'm not doing anything stupid like wanting to keep my (passphrase protected) rsa keys on there but I'd just rather not leak out my IP addresses you know?

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Is there a reason it has to be a public repo? I do something similar but just use a private repo...

necrotic
Aug 2, 2005
I owe my brother big time for this!
Yeah just use bitbucket for that as you get free private repos.

ToxicFrog
Apr 26, 2008


Or just put it on one of the machines you can ssh into.

Tigren
Oct 3, 2003
My company just rolled out Gerrit Code View and so I now need to rely on a git hook to append a ChangeId to my commits. This is the first time I'm using hooks and none of them seem to be triggering.

I don't even know where to start troubleshooting this really. Hooks seem to just be shell scripts. I can't even get a basic one that echo's a string to trigger.

Permissions are set properly. What else should I be looking at?

necrotic
Aug 2, 2005
I owe my brother big time for this!
Does the hook file have an extension? They have to be hook-name exactly, no extensions. Hooks can be any executable file, as long as the name matches.

If it's a shell script (or any other interpreted file) you need a shebang at the top declaring the interpreter.

If the name is correct I'd sprinkle some debug statements in the script and make sure they are output.

edit: added some more.

necrotic fucked around with this message at 23:46 on Jun 19, 2017

Tigren
Oct 3, 2003

necrotic posted:

Does the hook file have an extension? They have to be hook-name exactly, no extensions. Hooks can be any executable file, as long as the name matches.

If it's a shell script (or any other interpreted file) you need a shebang at the top declaring the interpreter.

If the name is correct I'd sprinkle some debug statements in the script and make sure they are output.

edit: added some more.

No extension. Shebang at top. Debug statements don't fire. Even something as simple as this:

code:
$ ls -al .git/hooks/commit-msg
-rwxr-xr-x  1 tigren  tigren  29 Jun 19 17:35 .git/hooks/commit-msg

$ cat .git/hooks/commit-msg
#!/bin/sh

echo hello world!

Tigren
Oct 3, 2003
Welp, figured it out.

It turns out I had some github wrapper installed, called hub, which was aliased to git. Surely this is the issue, I thought.

Cleaned up hub, got rid of the alias, made sure I'm actually calling /usr/bin/git. Still no luck. This is on OSX, so no strace. Dtrace is available though, so I tried that out. Turns out, git was looking for my hooks in ~/.git-support/hooks.

code:
access("/Users/tigren/.git-support/hooks/pre-commit\0", 0x1, 0x1)               = 0 0
A quick Google for that directory turns up a tool from 18F (a government tech group) called *laptop*. This tool configures OSX as a developer environment. The tool installs git-seekret and configures a global git directory. Apparently, git only looks at that global directory and not the local hook directory as well.

code:
$ git config core.hooksPath
/Users/tigren/.git-support/hooks
Once I unset that option, local hooks are working!

code:
$ git config --global --unset core.hooksPath
$ git config core.hooksPath
Moral of the story, don't install random poo poo and forget about it.

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'm using Git LFS with my Bitbucket account and I noticed I have a few large binary files that still show up in the LFS storage online but I'm 99% sure that I've deleted them and don't need them anymore. Is my understanding correct that these files still show up in the LFS repository simply because some old commit(s) reference them? If so I would like to just delete them from the website interface to free up some limited LFS space I get.

Follow up question, is there a more "git" way to remove these files from the command line? Like some kind of git lfs prune or similar command?

necrotic
Aug 2, 2005
I owe my brother big time for this!

Boris Galerkin posted:

I'm using Git LFS with my Bitbucket account and I noticed I have a few large binary files that still show up in the LFS storage online but I'm 99% sure that I've deleted them and don't need them anymore. Is my understanding correct that these files still show up in the LFS repository simply because some old commit(s) reference them? If so I would like to just delete them from the website interface to free up some limited LFS space I get.

I'm not familiar with LFS usage, but with git in general it is the case that a "deleted" file still exists in the history. You have to use filter-branch to go back through history and delete the files from every previous commit, thus building an entirely new history. This also means the repo will be 100% out of sync with anyone else using it.

GitHub has a pretty good article on removing files completely: https://help.github.com/articles/removing-sensitive-data-from-a-repository/

All of it should apply to LFS as well.

Boris Galerkin posted:


Follow up question, is there a more "git" way to remove these files from the command line? Like some kind of git lfs prune or similar command?

All git commands should work against LFS files, right? So git rm the/file.bin and then commit the deletion.

Adbot
ADBOT LOVES YOU

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

I have a personal fork of an open source project on github (because I'm not an official maintainer of the main project). I made some small changes and did a couple pull requests (which got accepted, yay!) and then I wanted to sync my fork with upstream again.

Of course I still have no idea what I'm doing in git and I ended up mangling everything so my github fork shows I'm some # of commits "ahead" of upstream, which are all just duplicated commits plus a merge commit.

Is there a simple way to fix this so my fork is just matching with upstream master again?

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