git Branch management

Hi!

I'm not entirely clear on the best way to handle branches using SC.

Once I'm linked, can I just manipulate the repository from behind the scenes and then refresh?  Or do I need to unlink, relink every time I change my working branch?

Ideally, branching would be built into the UI so I could, at a minimum, switch branches.

Answers

  • I think that with git you should be able to to just switch branches without relinking every time.
  • ben_bben_b Posts: 84 Silver 2
    Hi @Diogo, @David Atkinson, @Kendra_Little

    I haven't been using Redgate SQL Source Control for the last couple of years (we've been using Visual Studio and Database projects) but I am now looking at Redgate SQL Source Control again as I prefer the 'connected' method of development.

    I kind of agree with the following statement made by the original poster.

    "Ideally, branching would be built into the UI so I could, at a minimum, switch branches". 

    Is this something that you guys are considering?

    I saw a video where Kendra uses sublime merge for handling conflicts, I was wondering what the redgate teams use for creating/switching branches (excluding the command line)?

    cheers
    Ben
  • ben_bben_b Posts: 84 Silver 2
    edited January 8, 2020 4:25PM
    p.s.  i actually think there are quite a few advantages of using redgate sql source control vs visual studio/database projects

    such as 
    • no annoying conflicts on the .dbproj file
    • no re-keying from SSMS to Visual Studio (don't have to keep jumping around between IDEs)
    • much nicer interface
    • schema comparison less buggy
    • you can see other people's changes more easily
    visual studio has improved massively in the last 2 years tho.

    The pros/cons of each is what i'm currently researching (including the pros/cons between the redgate and microsoft build/release plug-ins in Azure DevOps).

    But one small advantage of Visual Studio is that it has the branch management gui.

    cheers
    Ben
  • @ben_b Would you expect to switch branches from within SSMS or using, for example, the Git command line (checkout -b) or an external Git client? If so it should be possible to achieve this using a post-checkout git hook which would run the SCA cmdlets or SQL Compare command line to update the database to be at the right database version.

    David Atkinson
    Product Manager
    Redgate Software
  • ben_bben_b Posts: 84 Silver 2
    Thanks david.  I would probably like to be able to create and switch branches from redgate sql source control gui within SSMS, so I can stay in one place.  

    I don't think i would need/want the database to change after each switch of branch though, I could get the database & branch in the position I want using the 'Commit' & 'Get Latest' tabs within RedGate Sql Source Control.

    What I would ideally be after is this screen which pops up when you click the arrow next to your current branch.



    Have it appear when you click the branch label in Redgate Sql Source Control



    Hope that makes sense.  I've only been using git for ~7 months so i'm no expert !

  • @ben_b So you're happy with seeing the changes in the branch appearing as items in the 'get latest' screen? This should work as expect today except that you'll need to type the git checkout commands manually (it would be great if you could try to switch branches and let us know if the end result in the Get Latest screen is as you would expect). 

    What is the specific reason you wouldn't want it to auto-sync your DB with the state of the new branch?

    Adding branch switching is something we may consider, although this would be most likely in the context of an integration with SQL Clone. 
    David Atkinson
    Product Manager
    Redgate Software
  • ben_bben_b Posts: 84 Silver 2
    "So you're happy with seeing the changes in the branch appearing as items in the 'get latest' screen?"  I think so yep.

    "This should work as expect today except that you'll need to type the git checkout commands manually (it would be great if you could try to switch branches and let us know if the end result in the Get Latest screen is as you would expect)."  Typing the git commands manually is what I was I hoping the RedGate UI could do for me!  I like having as few applications open as poss, others in my team dont want to use the command line at all.  

    What is the specific reason you wouldn't want it to auto-sync your DB with the state of the new branch?

    We use shared databases environments at the moment.  We have laptops with 250gb hard disks but our DWH databases are much bigger and we haven't looked at making smaller copies because its a bit of a spaghetti architecture.

    Also, if there is a lot of context switching then you may have a branch you haven't touched for a week or so and its nice to have the control to put things back manually and refresh your memory of what you were doing.

    cheers, Ben :)
  • ben_bben_b Posts: 84 Silver 2
    "it would be great if you could try to switch branches and let us know if the end result in the Get Latest screen is as you would expect" - I will have a play around next week and get back to you
  • ben_bben_b Posts: 84 Silver 2
    another advantage or RG Sql Source Control is that you dont have the added hassle of sorting out cross database references that you find with Visual Studio database projects.

    so, i'm putting the full list below for my own notes

    • no annoying conflicts on the .dbproj file
    • no re-keying from SSMS to Visual Studio (don't have to keep jumping around between IDEs)
    • much nicer interface
    • schema comparison less buggy
    • you can see other people's changes more easily
    • cross-db references can be annoying in VS database projects
  • ben_bben_b Posts: 84 Silver 2
    just been playing around with this.  two more possible advantages of RedGate

    1.  Visual Studio db projects can have duplicate object definitions
    2.  I think you can't (easily) see the SQL definitions in dacpacs but you can in SCA nu-get packages (unconfirmed!)
  • @ben_b It's possible to extract a model script from a dacpac (a little known feature). I think you have to unpack the dacpac rather than unzip it, or something along those lines.

    David Atkinson
    Product Manager
    Redgate Software
Sign In or Register to comment.