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
ToxicFrog
Apr 26, 2008


Rocko Bonaparte posted:

I had actually tried this so maybe I have something else to ask about here. I'm working on Windows here, using Git Extensions. The closest I found to being able to mount sshfs is DokanSSHFS. For simple copy kind of operations it was working fine. However, I couldn't even init a repository with it. Something in the Git Bash with Git Extensions was also getting in the way; it was flipping around path separators and then not finding the path. I have no idea what the deal was there. I imagine you were thinking about mounting sshfs on Linux, but I'm wondering instead if there's a well-vetted method for doing the same on windows.

To be honest, I have no idea. I was rather thinking about doing it on linux; I do none of my development on windows and don't really know if there's a good sshfs implementation for it. There wasn't last time I checked, but that was years ago.

If you're using windows you'll probably have a much easier time either backing it up using dumb storage, or installing git on something you can ssh into and pushing to that.

Adbot
ADBOT LOVES YOU

Golbez
Oct 9, 2002

1 2 3!
If you want to take a shot at me get in line, line
1 2 3!
Baby, I've had all my shots and I'm fine
Is there some way to maintain metadata about a branch in git? I'd like to be able to keep track of which branches are currently in testing, waiting for more feedback, in testing but also getting new features, when it was last updated, etc. all in one place without having to resort to maintaining an external spreadsheet.

Or, is there a way to simply get a list of the git branches, and have it display when they were last merged into test or what not? Right now to do this I think I'd have to go through each branch individually and check its status.

nexus6
Sep 2, 2011

If only you could see what I've seen with your eyes

uXs posted:

Seems ok to me. Pull. Do work, commit. Repeat that step until you feel like pushing. Then pull & merge anything that changed while you were working, and push.

Of cource, if you're one of those weirdos that insists on a linear history, then never mind.

It sound simple in theory until I have made about sixteen commits, pull and everything breaks so I have to create a new clean branch and cherry-pick every single commit.


Deus Rex posted:

is there any reason you're not putting those config files in .gitignore, or the repo exclude? it seems that would streamline your workflow quite a bit

This sounds like what I want, but do I have to do this for every new branch I create? Because whenever I want to start working on a new feature I have to clone the master into a new branch

nexus6 fucked around with this message at 15:28 on Apr 5, 2012

uXs
May 3, 2005

Mark it zero!

nexus6 posted:

It sound simple in theory until I have made about sixteen commits, pull and everything breaks so I have to create a new clean branch and cherry-pick every single commit.

Merge early, merge often.

nexus6
Sep 2, 2011

If only you could see what I've seen with your eyes

uXs posted:

Merge early, merge often.

I learned that, but it just seems wrong to me that I have to start every day downloading the updates or I risk loving everything up.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

uXs posted:

Merge early, merge often.

I guess my main workflow issue is this: We've been using CVS through Eclipse (since we mainly do Java development), and Eclipse's built-in CVS support is really nice. It doesn't matter how much work my teammate does since my last checkout, if he's checked in a bunch of changes and I have a bunch of pending changes as well, it's super easy for me to synchronize with the repo, view all the changes, commit my non-conflicting ones, check out his non-conflicting ones, and then interactively merge where conflicts exist and then commit those back.

We've tried using our old workflow with git/eGit (remote on Github), and while eGit is nice it definitely doesn't feel as mature as the CVS support. It's been a clusterfuck a couple times when we both had changes to the same resources, which made me think that git's distributed model might encourage a different/better workflow for this.

uXs
May 3, 2005

Mark it zero!

Flobbster posted:

I guess my main workflow issue is this: We've been using CVS through Eclipse (since we mainly do Java development), and Eclipse's built-in CVS support is really nice. It doesn't matter how much work my teammate does since my last checkout, if he's checked in a bunch of changes and I have a bunch of pending changes as well, it's super easy for me to synchronize with the repo, view all the changes, commit my non-conflicting ones, check out his non-conflicting ones, and then interactively merge where conflicts exist and then commit those back.

I read this until I get to "I merge my UNCOMMITTED changes with ..." which makes me cry.

Flobbster posted:

We've tried using our old workflow with git/eGit (remote on Github), and while eGit is nice it definitely doesn't feel as mature as the CVS support. It's been a clusterfuck a couple times when we both had changes to the same resources, which made me think that git's distributed model might encourage a different/better workflow for this.

Workflow for a DCVS system is:

-I do something.
-Some other guy does something.
-Other guy commits, pulls (but there's nothing to pull), and pushes.
-I commit.
-I pull the other guy's changes.
-I merge. If my merge fails because of whatever, I can just throw everything away and retry the merge. Nothing is ever lost because I have already committed. This step can be retried as much as you like. If there's a lot of commits you have to merge with, you could also merge in steps. But I've never needed to.
-I commit the merge, pull again (because the merge has taken some time), and push.

If a merge is trivial, the DCVS tool should do almost everything automatically. If the merge isn't trivial, you need some brains and a good merge tool. What merge tool you use doesn't really depend on the source control system you use.

The biggest advantage to a DCVS, to me, is that you commit first, and only then merge. A merge can be retried as much as you like, because everybody's changes have already been committed and are safe. There is no such thing as 'pending changes'.

ColdPie
Jun 9, 2006

Flobbster posted:

Can anyone recommend a good resource that just lays it out in simple terms, "here's the best way to set up your workflow for a small number of users working concurrently"? I don't need any of that dictator-model stuff -- both of us know what we're doing on the project and don't need to complicate things by adding access tiers.

What uXs said (although I prefer explicit git-fetch/merge to git-pull, since I deal with lots and lots of branches). You might also find gitworkflows(7) helpful.

Thermopyle
Jul 1, 2003

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

Am I the only one who gets to coding and does lots of bug fixes and whatnot and then realizes the last 10 git commits were done to the wrong branch?

What's your preferred way of handling this?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Takes about 30 seconds to cherry-pick them over to the right branch if there's no conflicts. Alternatively, make a temp branch and interactively rebase it onto the correct branch, discarding all of the commits from the bad branch, then reset the correct branch to the temp branch.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

Thermopyle posted:

Am I the only one who gets to coding and does lots of bug fixes and whatnot and then realizes the last 10 git commits were done to the wrong branch?

What's your preferred way of handling this?

http://asemanfar.com/Current-Git-Branch-in-Bash-Prompt

As for my own question: has anyone here tried git notes? I can't think of a good use for them.

nexus6
Sep 2, 2011

If only you could see what I've seen with your eyes
I added all my local config files to .gitignore but in the diff log generated by our server it appears that those files have been committed anyway. What gives? Or am I misunderstanding something?

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.

nexus6 posted:

I added all my local config files to .gitignore but in the diff log generated by our server it appears that those files have been committed anyway. What gives? Or am I misunderstanding something?

Had they already been added and committed before you added the .gitignore file?

nexus6
Sep 2, 2011

If only you could see what I've seen with your eyes

musclecoder posted:

Had they already been added and committed before you added the .gitignore file?

No, I've since been advised to move my .gitignore file to the root dir instead and that seems to have done the trick.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Yeah, that's how they work. You can even put multiple .gitignore files in nested directories if there's certain kinds of files you only want to ignore in certain folders, like generated fixtures or whatever.

Rohaq
Aug 11, 2006
I'm wondering something, out of interest - I've got the following structure in subversion:

code:
/
|-archive
|-main
 |-project1
  |-branches
  |-tags
  |-trunk
 |-project2
  |-branches
  |-tags
  |-trunk
Archive is used to keep a record of older code from yore, and can be ignored, but I really want to enforce the directory structure under main/project - Keep the trunk as our working copy, and keep branches and tags to their respective directories. I'm a little worried that someone might accidentally create their branch in the trunk directory, or similar however. Is there any way to get subversion clients, GUI or CLI, to default branching/tagging to those directories? Even if we have to do this on a per-project basis, it'd be nice to try and get some kind of safety net into place.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Rohaq posted:

I'm wondering something, out of interest - I've got the following structure in subversion:

code:
/
|-archive
|-main
 |-project1
  |-branches
  |-tags
  |-trunk
 |-project2
  |-branches
  |-tags
  |-trunk
Archive is used to keep a record of older code from yore, and can be ignored, but I really want to enforce the directory structure under main/project - Keep the trunk as our working copy, and keep branches and tags to their respective directories. I'm a little worried that someone might accidentally create their branch in the trunk directory, or similar however. Is there any way to get subversion clients, GUI or CLI, to default branching/tagging to those directories? Even if we have to do this on a per-project basis, it'd be nice to try and get some kind of safety net into place.

add a check to precommit hooks, hopefully there's some simple way you can distinguish between just another directory being added and a whole copy of the tree being added.

Catalyst-proof
May 11, 2011

better waste some time with you
I have the following git history in a repository.

code:
* [other] Commit 5
* Commit 4
M-. Merge Commit
| * Commit 3
* | [master] Commit 2
* | Commit 1
I-' [origin/master] Initial commit
When I'm on `other`, and I try to interactively rebase against `master`, I get a merge conflict. But it's the same merge conflict that I already went through and resolved when creating the Merge Commit. Isn't there a way I can tell git to resolve it the way I already resolved it?

EDIT: git rebase -p causes git to attempt to recreate merges, but when squashing everything it still asks me to re-resolve the conflicts.

EDIT2: More messing around with git rebase -p, especially git rebase -i -p HEAD~2 and squashing from there, seemed to have done the trick.

Catalyst-proof fucked around with this message at 04:44 on Apr 16, 2012

revmoo
May 25, 2006

#basta
How do you force Git to ignore CHANGES to a file but keep the initial version? I know about git update-index --assume-unchanged, but that doesn't propogate the changes to the master repo, just local, and if I add the file to .gitignore it deletes it. I need to keep a bunch of config files but ignore all changes. Can't find this in the Git book anywhere.

pseudorandom name
May 6, 2007

You append .template or .original or somesuch to the file name and rename or copy the file during deployment.

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.

revmoo posted:

How do you force Git to ignore CHANGES to a file but keep the initial version? I know about git update-index --assume-unchanged, but that doesn't propogate the changes to the master repo, just local, and if I add the file to .gitignore it deletes it. I need to keep a bunch of config files but ignore all changes. Can't find this in the Git book anywhere.

Someone posted an answer to this using Git a few pages back, but I agree with pseudorandom name. I have configure.template and configure in my codebase. configure.template is version controlled, and has placeholder values for database configs, 3rd party API keys, or any other data that shouldn't be versioned.

My build process for my local development box would add development configuration data, and likewise when a build is pushed to production, the production parameters are added.

revmoo
May 25, 2006

#basta
I'd rather just keep the file as-is. I know it can be done because I've worked on systems that were already configured to do this.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

uXs posted:


The biggest advantage to a DCVS, to me, is that you commit first, and only then merge.

I don't want to be fussy here or anything but this behavior is not a feature of a dvcs. you can do the same thing in svn (or cvs iirc)

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
I think uXs is talking about local changes that are only in your working copy/repository -- running svn update or cvs update does a small merge at that time. If there's no textual conflict between what changed in the repository and your local modifications, I believe SVN will gracefully merge them. Otherwise, you get a conflict marker in your file. Even if you're working on a branch, your local uncommitted changes are in danger whenever you update.

Git, on the other hand, will abort a merge if any of the affected files have local modifications. The intent is that your local modifications should be commits instead of modified files; this helps in merging the history, and most importantly you don't have any risk of losing your work.

etcetera08
Sep 11, 2008

This may be a stupid question, so apologies if I'm missing a basic facet of version control. I'm kind of learning as I go and I didn't see anything right off hand while Googling this. Submodules are confusing.

Anyways, I have a git repo (https://github.com/seubert/dotfiles) with a bunch of submodules for my vim plugins and a couple other things. If I edit one of these submodules how do I track/commit/push these changes? Should I not be using submodules at all in this case?

To be more specific, I added a new theme in oh-my-zsh and I want to be able to push that but it doesn't track it since my changes are in a submodule.

edit: I see this: http://stackoverflow.com/questions/5542910/how-do-i-commit-changes-in-a-git-submodule but I'm still not totally sure what to do.

etcetera08 fucked around with this message at 19:36 on Apr 21, 2012

sklnd
Nov 26, 2007

NOT A TRACTOR
Git submodules are just you telling git that you're going to have a repository in your repository. Git will track the state of the submodule by the commit hash of some commit in the submodule. When you update the submodule (and presumably put these changes somewhere), in the parent repository you git add and git commit the submodule as if it were a file. The resulting diff will show you the old and new commit hash.

In your specific case, I would expect you would need to fork oh-my-zsh, use the fork url for your submodule url, and manage changes to the submodule as you would any other project, except you would update your dotfiles repo when you wanted to point to a new commit in the submodule.

etcetera08
Sep 11, 2008

sklnd posted:

Git submodules are just you telling git that you're going to have a repository in your repository. Git will track the state of the submodule by the commit hash of some commit in the submodule. When you update the submodule (and presumably put these changes somewhere), in the parent repository you git add and git commit the submodule as if it were a file. The resulting diff will show you the old and new commit hash.

In your specific case, I would expect you would need to fork oh-my-zsh, use the fork url for your submodule url, and manage changes to the submodule as you would any other project, except you would update your dotfiles repo when you wanted to point to a new commit in the submodule.

Makes perfect sense, thanks!

Catalyst-proof
May 11, 2011

better waste some time with you
Is there a way to tag multiple git branches with the same identifier? I'm working on a game, and I'm trying to keep all of my commits small, but that sometimes means that various branches will crash on launch, or what-have-you, and I'd like to mark them all with some 'broken' token in source control.

pseudorandom name
May 6, 2007

You can use git notes to add notes to commits. git log, git show, etc. will show them as if they were a part of the commit message.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Fren posted:

Is there a way to tag multiple git branches with the same identifier? I'm working on a game, and I'm trying to keep all of my commits small, but that sometimes means that various branches will crash on launch, or what-have-you, and I'd like to mark them all with some 'broken' token in source control.

You can prefix them. broken/resource-caching, wip/gles-only, etc.

Nippashish
Nov 2, 2005

Let me see you dance!
One of my projects has a module that's rapidly outgrowing the project it's a part of. I'd like to pull it out into its own separate repository, but I'd like to pull its commit history with it.

Specifically, I've got a repository like this:
code:
repo
|- root stuff
|- module1
|  \- module1 stuff
|- module2
|  \- module2 stuff
\- module3 <--- I want to pull out everything in this folder
   |- files
   |- and
   \- directories
I'm using git, and unfortunately the commits that affect module3 aren't all together in time (since I've been working on other parts of the project as well) and there are probably at least a few commits that affect files both inside and outside of module3 (since I have horrible discipline).

I'd like to build a new repository and populate it with all of the commits from this repository that touch any files in the module3 subtree. It's okay if this pulls a few extra files along with it since I can clean those out of the new repository by hand, but how do I extract the directory with its commit history?

ToxicFrog
Apr 26, 2008


Nippashish posted:

One of my projects has a module that's rapidly outgrowing the project it's a part of. I'd like to pull it out into its own separate repository, but I'd like to pull its commit history with it.

I'm using git, and unfortunately the commits that affect module3 aren't all together in time (since I've been working on other parts of the project as well) and there are probably at least a few commits that affect files both inside and outside of module3 (since I have horrible discipline).

I'd like to build a new repository and populate it with all of the commits from this repository that touch any files in the module3 subtree. It's okay if this pulls a few extra files along with it since I can clean those out of the new repository by hand, but how do I extract the directory with its commit history?

I have not used it myself, but I'm pretty sure that git filter-branch --subdirectory-filter module3 is what you're after, possibly with --prune-empty as well (although I think --subdirectory-filter makes that unnecessary in this case).

Do that on a clone of the original repo, then delete the original branches from it and the origin remote and you have a new repo containing all of the history, and only the history, of module3, with the contents of module3 as the repo root.

nonathlon
Jul 9, 2004
And yet, somehow, now it's my fault ...
An odd problem I've encountered, that _might_ be to do with Mercurial. Or not. Bear with me:

We use this large and popular genomics webapp Galaxy to wrap and link some complex tools. A recent innovation in Galaxy is the concept of a "toolshed", a separate webapp that people can upload their own tools to and other can download and install into their own application instances. And these toolsheds store the uploaded tools as Mercurial changesets.

Anyway, our own toolshed is consistently generating errors when it's used, that looks like a unicode error involved with the Mercurial repo, where a unicode filename fails to be forced into an ascii one. I've been back and forth with the Galaxy developers and basically I'm the only one ever, anywhere, who has ever seen this error.

So, after that long build up: what sort of things might cause encoding errors with Mercurial? Is there any obvious configuration or settings that I might look at?

bootleg robot
Dec 8, 2004

Hey all, I had a question concerning version control best practices.

I've written a decent sized application, and use subversion as version control. I have begun the process of placing the front end and the back end into their own separate assemblies. Does it make sense to maintain separate repositories for both? My reasoning is this would allow me to revert back to earlier revisions in the back end, for example, without losing changes to the front end.

Is this the way to go, or is there a better way?

Zhentar
Sep 28, 2003

Brilliant Master Genius
You don't have to revert the entire repository. You can perform operations on items within it separately.

Physical
Sep 26, 2007

by T. Finninho
Github talk:

We have a repo that houses our production source. We want to be able to have a dev branch, and a production branch. The dev side will be doing things like feature development and bug fixes. I'm a noob to git/github and am wondering how other people/repo's handle situations where they have a feature branch that they are 3 months from deploying, but simultaneously have a bug fix that needs to be deployed to production immediately. And then that bug-fix needs incorporated into the feature branch.

Are there any write-up's on this kind of thing? What would you recommend?

edit: here is a thing http://nvie.com/posts/a-successful-git-branching-model/

Physical fucked around with this message at 20:24 on May 3, 2012

sklnd
Nov 26, 2007

NOT A TRACTOR
Make the fix on a hotfix branch, put it in production, then rebase your feature branch or cherry pick that fix or merge it or really whatever suits your fancy.

Mine GO BOOM
Apr 18, 2002
If it isn't broken, fix it till it is.

bootleg robot posted:

I've written a decent sized application, and use subversion as version control. I have begun the process of placing the front end and the back end into their own separate assemblies. Does it make sense to maintain separate repositories for both?
If you have a nice API between the two, two separate repos are a good way to go. When you release changes that require both sides to be updated but isn't compatible with each other during the switchover, do a versioned API (call backend.com/v2/getdata instead of backend.com/v1/getdata) so you can release each part individually and not have to break things. Once both sides are stable with v2, in the backend you can delete the v1 of the API if it doesn't make sense to keep it.

Of course, I'm speaking from developing a project with 4-10 developers who work on both the frontend and backend at different times, so having separate repos makes a lot of sense since about 90% of our changes are either completely on one side or the other.

Optimus Prime Ribs
Jul 25, 2007

Recently this week I finally got around to using Git.
I've gotten the hang of it, and can create repos/commit my changes and all that junk now, but there's just something I'd like clarification on.

When I do git add foo.py does that just mean "add this to the list of items that will be commited" and nothing else?
That's what it seems to mean (and that's what the help files seem to be saying), but I just want to be sure.

The only other version control I have experience with is TortoiseSVN (which I hated) so pardon my stupid question. :)

Adbot
ADBOT LOVES YOU

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Optimus Prime Ribs posted:

When I do git add foo.py does that just mean "add this to the list of items that will be commited" and nothing else?
That's what it seems to mean (and that's what the help files seem to be saying), but I just want to be sure.

There's three 'sections' active when using git, your working set, the stage and the repository. The working set is the current set of files, just as they appear on disk. The repository is a series of snapshots you can check out (potentially overwriting) to the working set. The stage is a set of changes that can be written to a new snapshot in the repository. Adding a file writes the state of the file at the time add is run to the stage. This means if you add foo to the stage, then edit foo, none of those edits will make it into the commit unless you readd the file.

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