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
Dromio
Oct 16, 2002
Sleeper
I'm switching our team from svn to git. I've been using git-svn for a long time and thought I had a pretty good handle on it, but now that I've got everyone using git I see I need to change my workflow a little bit.

How do you handle feature branches and collaboration? Especially if you want to merge more than once. Say I make a new branch from master called features/AddAWidget. I hack on that branch for a while until I want to incorporate it in the build, so I merge features/AddAWidget into master and push it. Then later I want to refine that feature a bit, so I checkout that same branch. Here's where I get confused...

I used to 'git rebase master' to keep my feature branch up to date. But now that I'm sometimes pushing and sharing that branch, it seems that's a bad idea. So what do I do? Do I merge feature into master, then merge master back into feature?

I'm getting a little confused here.

Adbot
ADBOT LOVES YOU

Mithaldu
Sep 25, 2007

Let's cuddle. :3:

Dromio posted:

I'm getting a little confused here.
Once you've merged it into master it's best to leave it at that and just make a new branch if you want to change that feature again.

Dromio
Oct 16, 2002
Sleeper

Mithaldu posted:

Once you've merged it into master it's best to leave it at that and just make a new branch if you want to change that feature again.

What if I'm doing something like described here? If I merge the feature branch into the "develop" branch using "--no-ff" will I be able to continue working on the feature branch and merge it into develop again later? Even if I don't keep the feature branch up-to-date from changes others have put into develop elsewhere?

Mithaldu
Sep 25, 2007

Let's cuddle. :3:
I am in somewhat of a hurry, so i cannot mull over the details right now, but please let me suggest you to watch the first half of this video to maybe improve your mental model of git commits. :)

http://blip.tv/open-source-developers-conference/git-for-ages-4-and-up-4460524

Mithaldu
Sep 25, 2007

Let's cuddle. :3:

Dromio posted:

If I merge the feature branch into the "develop" branch using "--no-ff" will I be able to continue working on the feature branch
Yes.

Dromio posted:

and merge it into develop again later?
Yes.

Dromio posted:

Even if I don't keep the feature branch up-to-date from changes others have put into develop elsewhere?
Yes.

As long as you're fine with not having the latest and greatest from develop in your feature branch that's all easily doable. But honestly, i'd suggest to gently caress merging and rebase your poo poo. You do feature branches usually because you're the only one working on them, so it's fine to get creative on them. Rebasing also gives you the MASSIVE advantage of being able to rebase up one-by-one and resolve conflicts piece by tiny piece, instead of in one massive merge.

Dromio
Oct 16, 2002
Sleeper

Mithaldu posted:

But honestly, i'd suggest to gently caress merging and rebase your poo poo.

That's what I had been doing when I was working in the remote repository alone. But now it complains if I push a branch to origin after rebasing. And that makes sense-- I can't rewrite history if someone else might have checked it out elsewhere. I want to do collaborative work on features moving forward, so it's going to be a bit of trouble.

Mithaldu
Sep 25, 2007

Let's cuddle. :3:

Dromio posted:

That's what I had been doing when I was working in the remote repository alone. But now it complains if I push a branch to origin after rebasing. And that makes sense-- I can't rewrite history if someone else might have checked it out elsewhere. I want to do collaborative work on features moving forward, so it's going to be a bit of trouble.

If multiple people collaborate on the same feature, make your contributions in sub-branches of your own. Remember, rebasing is only ever an issue if two people work on the same branch and even then there's quite a few circumstances where it's fine, thanks to cherry-picking being a thing.

uXs
May 3, 2005

Mark it zero!

Mithaldu posted:

As long as you're fine with not having the latest and greatest from develop in your feature branch that's all easily doable. But honestly, i'd suggest to gently caress merging and rebase your poo poo. You do feature branches usually because you're the only one working on them, so it's fine to get creative on them. Rebasing also gives you the MASSIVE advantage of being able to rebase up one-by-one and resolve conflicts piece by tiny piece, instead of in one massive merge.

Merging is possible step by step too, you know. Admittedly, it won't look pretty :-)

ianN
Apr 7, 2009
Anyone know of a good Linux SVN client? Comparable to Tortoise for Windows.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

uXs posted:

Merging is possible step by step too, you know. Admittedly, it won't look pretty :-)
I suppose you could rebase step by step on a temp branch and use the result of that as the merge conflict resolution.

HFX
Nov 29, 2004

ianN posted:

Anyone know of a good Linux SVN client? Comparable to Tortoise for Windows.

You mean a GUI? Most Linux distro's come with an SVN client installed. You should go ahead and learn the command line as it opens a lot of powerful tools. As to a GUI, Nautilus already has support for SVN and there is RapidSVN.

Edit: Has anyone here used RTC and could point me to a good tutorial of how best to use it and hopefully deals with ideas such as topic branches? We've been using it for a project, and to describe the current usage as painful is being kind.

HFX fucked around with this message at 22:29 on Oct 25, 2011

Mithaldu
Sep 25, 2007

Let's cuddle. :3:

Plorkyeran posted:

I suppose you could rebase step by step on a temp branch and use the result of that as the merge conflict resolution.

That is a pretty interesting idea, i like that!

indulgenthipster
Mar 16, 2004
Make that a pour over
I've been using git for the past several months in a very basic way. I am a one man web development company, and use git through Aptana just to keep track of my own revisions. After releasing an application I decided I should start looking into creating branches to keep even better track of updates I make to the live application.

In Apatana, I created a new branch that I called "1.01". I've made many commits through it and the development site always reflects 1.01 (http://mysite.local). Once it all looked good, I merged it into the master branch.

My first question is if I'm on the right track with how I am handling branches. My next one will be something like 1.02. Is this correct?

Also, since the actual working directory always has the latest changes, is it possible to have the master branch sitting in it's own folder so I can always have that copy to reference with a URL like http://mysite-master.local? Or how would that be handled?

Xik
Mar 10, 2011

Dinosaur Gum

VerySolidSnake posted:

Also, since the actual working directory always has the latest changes, is it possible to have the master branch sitting in it's own folder so I can always have that copy to reference with a URL like http://mysite-master.local? Or how would that be handled?

Clone your repo, checkout the master branch and serve it.

ColdPie
Jun 9, 2006

VerySolidSnake posted:

I've been using git for the past several months in a very basic way. I am a one man web development company, and use git through Aptana just to keep track of my own revisions. After releasing an application I decided I should start looking into creating branches to keep even better track of updates I make to the live application.

In Apatana, I created a new branch that I called "1.01". I've made many commits through it and the development site always reflects 1.01 (http://mysite.local). Once it all looked good, I merged it into the master branch.

My first question is if I'm on the right track with how I am handling branches. My next one will be something like 1.02. Is this correct?

There isn't really a single "correct" way to do this stuff. Source control is a tool; use it in whatever way works best for you.

If you're doing completely linear development and not maintaining old versions, then you can just use tags to mark "milestone commits" (aka releases):

pre:
o---o---o---o---o---o---o
        ^       ^       ^
      v1.0    v1.1     HEAD
If you want to maintain bug fixes for older versions, you would use a branch:

pre:
              v1.0.1
                v
          b1---b2
         /
o---o---o---b1---o---b2---o
        ^        ^        ^
      v1.0     v1.1      HEAD
Here b1 and b2 are bugfix commits that both apply to features that existed in v1.0, as opposed to the o commits which are new features or whatever. As you discover these fixes on your path to v1.1 and beyond (until you end-of-life the 1.0 series), you cherry-pick them across to the 1.0 branch and do minor releases there with tags*. (You could also create a bugfix branch off of your latest development HEAD and merge that into your release branches, but frankly, I think feature branches and merging are more work than they're worth in most cases.)

*Note: This is one of several reasons why you should make your commits small and atomic. Don't just treat commits like a snapshot of your working tree.

What you describe sounds to me something like this:

pre:
o---o---o   <-- branch v1.0
        ^\
     v1.0 \
           \-o---o   <-- branch v1.1
                 ^\
              v1.1 \
                    \-o---o   <-- branch v1.2
                          ^
                        HEAD
which is exactly the same as the first scenario, but you've got a bunch of unused branches laying around for no reason.

ColdPie fucked around with this message at 00:55 on Oct 27, 2011

Mithaldu
Sep 25, 2007

Let's cuddle. :3:
I think that last diagram isn't entirely honest, since for git tag markers and branch markers are exactly the same except for the single defining differences that branch markers move on when you commit while they're active.

indulgenthipster
Mar 16, 2004
Make that a pour over
ColdPie, I appreciate the response!

Tags seem to make the most sense since development is linear. I also found some git commands that would allow me to clone a previous git tag into a different directory, so if I wanted I could have easy access to testing old versions.

I believe I will also stick with using 2 branches for now as well. One as the master, the other as development. Once I merge the two, I will create a tag, then begin working on the development branch again.

uXs
May 3, 2005

Mark it zero!

VerySolidSnake posted:

ColdPie, I appreciate the response!

Tags seem to make the most sense since development is linear. I also found some git commands that would allow me to clone a previous git tag into a different directory, so if I wanted I could have easy access to testing old versions.

I believe I will also stick with using 2 branches for now as well. One as the master, the other as development. Once I merge the two, I will create a tag, then begin working on the development branch again.

Read this. It's about Mercurial, but explains why a default and a stable branch could be easier to work with than a development and a master branch.

Edit: this = http://stevelosh.com/blog/2010/05/mercurial-workflows-stable-default/

uXs fucked around with this message at 13:48 on Oct 27, 2011

Mithaldu
Sep 25, 2007

Let's cuddle. :3:
Actually, i can explain 4 words why having a dev and a master branch is counter-productive: You cannot bisect (sanely)!

Bisecting is the act of finding commits that introduced bugs by way of checking out the first, last, and middle commit of a repo, testing them; then repeating that for the "good" segment. If your commits are all intertwined with two branches merging back and forth this feature becomes pretty much entirely useless.

shrughes
Oct 11, 2008

(call/cc call/cc)

Mithaldu posted:

Actually, i can explain 4 words why having a dev and a master branch is counter-productive: You cannot bisect (sanely)!

It seems to work fine for me.

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
I am very new to git. So please bear with me if this is a simple question.

We have two developers, myself and someone in a remote location. The flow right now is, when he wants me to push something to our test server, he tells me, I do it, and when it's passed our testing I push it to the live server. We just got git and am learning it, and I was wondering how best to duplicate this division of responsibilities? Right now I'm thinking, we have master (live server), from which is branched test, from which is branched our development environments. We can both push our development environments to test, but I want to be the only one to be able to push to master. Can I, and how do I, set up this kind of restriction?

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
You want Gitolite. It's easy to set up and very powerful.

When you're using a server run by Gitolite, everyone uses the same user (git) and access control works through SSH keys. You can restrict his access so that he can't push to the master branch, but all other branch names are fine.

Deus Rex
Mar 5, 2005

:stare: holy moly look at those hashes https://github.com/vog/beautify_git_hash/commits/master

$ git log --format=oneline
0016ae203f6eea832955423d0230c13f79253d39 Fixed typo
0015aa2023bfdd5c07cd209055078c3d0d021e8b Improved introduction text
0014ac07575d500b76ee4304cfb72e0439c4ba7b Provide .gitignore
0013a87ea205f676c55f86348e9c3fcf6d9cda5d Provide a Git post-commit script
0012a12532c1fc3a37b4b3976282062df2604ad6 Suppress an otherwise misleading Git er
0011aeb1e6c54a735acaf1f86e4085a81bb45de7 Improved coding style
0010a17abe46935a634dd7948163ddfdb3a63d24 Automatically propose a new prefix when
0009a2599c168f24cdfe4eac1ee6f171525cbf9c Improved usage message
0008a192c3713ea7ca5cbb7788c089099d865119 Make script executable
0007a5ed133a9803ac77b4661fbef36b0219c12a Introduced new function show_proposal_f
0006a71f3baf593db0e0638445b6271a5dd6e9ef Improved naming of variables
0005a8c811d2c3ed904f9a46e135c6d755430df1 Added an introduction text to the modul
0004ada882d1733ca217d42fc43cdede06577776 Make the script also work on Python < 2
0003a5f11b18591383b61700fc18ccaaef3e0f7b Show a more appropriate output when the
0002a87e25527ea0de04244f879544a02153289e Improved coding style
0001a2f14eaf525be00b381b9b3dcd406a6ff7e1 Added the initial version

Mithaldu
Sep 25, 2007

Let's cuddle. :3:
That's cute, but won't be of much use when multiple people work on a repo.

ColdPie
Jun 9, 2006

Mithaldu posted:

That's cute, but won't be of much use when multiple people work on a repo.

Unless you put a hook on the main Git repo :tipshat:

Deus Rex
Mar 5, 2005

Mithaldu posted:

That's cute, but won't be of much use when multiple people work on a repo.

by the way, the idea originally came from the BitCoin project :v:

Sonic H
Dec 8, 2004

Me love you long time
I've started a VBA specific thread but this query I have might as well go here too:

Version Control in Excel VBA is a bit of a pain. Fine for one person of course, but multiple users starts to get messy. I/we currently use SourceTools.xla which is functional enough and integrates well with SVN/Tortoise, although there is a shortcoming with the .frx files due to VBA/Excel modifying files when they're exported for reasons best known to itself. This leads to an issue with the versioning of the .frx files as they're committed before they're changed (I think) so they always end up out of date for the next user.

SourceTools is a small VBA tool that effectively breaks the workbook into its component parts and stores them in a subfolder in addition to the main workbook whilst interacting with TortoiseSVN. Problem is, any changes to the sheets themselves are only stored in the workbook and aren't exported.

One of the problems is that if you have, say, one person working on the worksheets alone and another person on the VBA alone, it can get slightly messy when it comes to committing things. Ideally the VBA chap will commit modules using SourceTools, the sheets chap will "update" using SourceTools taking the new things on board before saving his workbook then performing a manual commit using Tortoise outside of Excel. It's awkward, but it *should* work.

It doesn't really get round the .frx problem however.

Anyone ever tried to VC a VBA Excel workbook that's co-developed by more than one person?

Sonic H fucked around with this message at 13:12 on Nov 2, 2011

Comrade Gritty
Sep 19, 2011

This Machine Kills Fascists

Sonic H posted:

Anyone ever tried to VC a VBA Excel workbook that's co-developed by more than one person?

I feel like this belongs in the Horror Thread.

Sonic H
Dec 8, 2004

Me love you long time

Steampunk Hitler posted:

I feel like this belongs in the Horror Thread.

You're probably right as thus far it works, but it's not pretty. Managing an Excel workbook is something nobody should have to do.

Dromio
Oct 16, 2002
Sleeper
I'm think I'm "doing it wrong" with git and trying to force it to follow my desired workflow.

I have a branch called "Production" that contains the code that's currently on Production.
I have a branch called "Development" that contains all the code that's been in development and the developers feel like might be ready for release, but is untested.
I have multiple feature branches like "feature/addTotalCountToReport" where a developer implemented a specific feature.

When a developer starts a task, they make a branch off "Development" and start their work. When they're done with the task, they push their feature branch to origin and merge it back into Development so it gets automatically built on our shared dev server for testing.

Then our QA guy comes to me and says "I want to deploy feature/addTotalCountToReport, but not feature/bigGiantChange because it still needs work". Originally I thought it was as easy as merging feature/addTotalCountToReport into my Production branch and building. But because that was branched from Devlopment originally, when I merge it'll bring in code from previous development branches that might not be wanted.

So how do I fix this? Should feature branches be built off Production, not Development? I think this might confuse the developers because they won't see the bugfix they did yesterday.

Or do I cherry-pick all the commits from the feature branch into Production? That seems kind of nasty, but seems to work.

Apok
Jul 22, 2005
I have a title now!
I had used SVN version control back in college for a database design class. We had stored all of our files on there and our group had loved it because we didn't have to pass around USB drives and version control allowed us to always have backups for when we did something we didn't want to do.

I now use git version control with a free ProjectLocker account for all of my code for my job. I'm trying to get my coworker to use it as well but he doesn't want to give it a chance. I love it however and have had to revert files to previous versions 4x in the last week or so. Big time saver for me.

Mithaldu
Sep 25, 2007

Let's cuddle. :3:

Dromio posted:

I have a branch called "Production" that contains the code that's currently on Production.
I have a branch called "Development" that contains all the code that's been in development and the developers feel like might be ready for release, but is untested.

Can we get a screenshot of what tortoisegit thinks this looks like? I have the feeling that that split right there is your issue. Normally you'd use tags, and if appropiate, localized small bugfix branches, to mark production stuff.

Dromio
Oct 16, 2002
Sleeper

Mithaldu posted:

Can we get a screenshot of what tortoisegit thinks this looks like? I have the feeling that that split right there is your issue. Normally you'd use tags, and if appropiate, localized small bugfix branches, to mark production stuff.

I'm having a terrible time uploading to imgur, but suffice it to say that the history log looks like a complete mess.

I'm not sure how to use tags to do what I want here. I want three devs to be able to work on 9 different features, and be able to pick and choose to only include code from feature 4 of 9 into production, then later be able to come back and add feature 3. But maybe it's just not really feasible.

My current thinking is that we can do it if we start branching features from Production and forget about the "Dev" branch altogether. So the workflow might be
code:
git checkout Production
git checkout -b feature/Whatever
... do the work and make the commit(s)
... ready to hand off for QA
git checkout Production
git checkout -b QA
git merge feature/Whatever
git push origin QA (so the CI server can see it and build/test)
... QA PASSES
git checkout Production
git merge QA
git push origin Production
git branch -d QA
git push origin :QA
... build and push to production server
Would this accomplish my goals? I think I SHOULD be able to easily merge a feature branch back into production code (with the usual possible conflicts for long-running branches). What other pitfalls would I encounter?

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
So we finally have git set up but I'm really confused how to handle multiple people merging.

I have a branch, test, that I merged a feature in to earlier today. The other developer has now merged his new feature into it, and in the process - since his new feature was branched off before I merged mine in - it deleted the files that mine added.

1) How do we get around this?
2) How can I force git to not remove files without asking?

Edit: Corollary: When should we pull, and I guess when we pull (I'm guessing before a merge?) we should merge the pulled copy into the branched feature?

Golbez fucked around with this message at 22:57 on Nov 3, 2011

uXs
May 3, 2005

Mark it zero!

Golbez posted:

So we finally have git set up but I'm really confused how to handle multiple people merging.

I have a branch, test, that I merged a feature in to earlier today. The other developer has now merged his new feature into it, and in the process - since his new feature was branched off before I merged mine in - it deleted the files that mine added.

1) How do we get around this?
2) How can I force git to not remove files without asking?

Edit: Corollary: When should we pull, and I guess when we pull (I'm guessing before a merge?) we should merge the pulled copy into the branched feature?

Did he actually merge with your things?

If he did, he did his merge incorrectly. But I don't know enough about Git to know where exactly.

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

uXs posted:

Did he actually merge with your things?

If he did, he did his merge incorrectly. But I don't know enough about Git to know where exactly.

We're still not sure what went wrong. Since we're converting an existing, non-version controlled codebase to use branches and all that, hiccups are slipping through. He never completed the merge, and now using a tool it seems like he's getting around it, but I'm still not sure.

uXs
May 3, 2005

Mark it zero!

Golbez posted:

We're still not sure what went wrong. Since we're converting an existing, non-version controlled codebase to use branches and all that, hiccups are slipping through. He never completed the merge, and now using a tool it seems like he's getting around it, but I'm still not sure.

A merge is a pretty simple concept. You have 2 revisions, and need to merge those into 1 revision. So you tell your system that, and it prepares for you a revision that it thinks is a combination of those two. If it can't, it should indicate to you where the problem areas are, and give you the opportunity to merge those areas manually.

When that's all done, you can check your work (this is where you should test both your changes as the changes the other guy made), and then commit it.

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
Fortunately, we finally got the problems worked out, it seems to have been a one-time hiccup caused by us pushing an existing codebase into git and then branching it out.

a slime
Apr 11, 2005

I want to create a git repository. This project ties together three external projects stored in other git repositories that are maintained by someone else. My project will combine two of these projects (which are already very similar) while the third is separate- the directory structure will look like this:

code:
my-git-repository/
-- external-projects-1-and-2-combined/
-- external-project-3/
I will periodically want to merge changes from these external projects back into my code. What is the best way to do this in git? From what I've read, referring to the external projects as submodules doesn't make sense because I'll be making a lot of local changes to all of these projects. Storing these projects in separate repositories doesn't make sense because very often a single commit will be related to all three external projects.

I was hoping that I could store all three projects as independent branches in my repository, and then do some kind of "merge into directory" thing, where I merge a local branch into a subdirectory of another. Is this possible? What's the best way for me to handle this?

Adbot
ADBOT LOVES YOU

Sonic H
Dec 8, 2004

Me love you long time
Using VisualSVN server, is there a way of changing the default project structure from trunk/tags/branches to <anything else>? So instead of having to go through generating a repo, then populating it with a predefined folder structure each time, I can have VSVN do it for me?

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