Git related Questions

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
Enjay
 
 
Posts: 27115
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Git related Questions

Post by Enjay »

I'm just working through the implications for me of the move to Git. I have installed Git and am using TortoiseGit to provide integration into my OS (Win7). It seems to be working smoothly enough and I have managed to get myself copies of the ZDoom and GZDoom sources using the GitClone TortoiseGit menu option and I have successfully compiled them.

Getting updates:
When the code is updated online, how do I get those updates? My guess is that I should pick "Git Sync..." from the Tortoise menu and then "Pull" the update in. Is that correct?

Working with my own code
Also, I have my own privately modified version of GZDoom. I asked about what would be needed to maintain that...
Graf Zahl wrote:Concerning modified private versions, you'll probably have to do one manual merge after initial checkout. Since your private stuff isn't versioned at all I don't think there's a tool that can do it automatically. On the positive side, since Git is a distributed version control system you'll now have a fully functional private repository you can do commits to. This will be local on your computer.
I can do the manual merge easily enough but I'd really appreciate some help on how to set things up from thereon in. I've been fiddling around with TortoiseGit for the last hour or so and I'm not making much headway. A big part of the problem is that I am unfamiliar with a lot of the terminology but I am just generally lost. If anyone is in a position to make a "Private version of GZDoom code on your machine under Git for Dummies" blow-by-blow post I'd really appreciate it. Thanks.
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Git related Questions

Post by Nash »

My entire project revolves heavily around SVN. Does this mean I have to scrap everything I've had setup and learn everything anew... =/

EDIT: Might as well ask. Why the switch to Git? What can it do that SVN can't? Does this also mean there will be git.drdteam.org?
User avatar
Enjay
 
 
Posts: 27115
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Git related Questions

Post by Enjay »

Well, I've managed to answer my first question. Doing what I suggested does indeed seem to update my local copy of the code. So, yes, builds should still be available at DRD (none uploaded yet).

I haven't figured out how to maintain my own local modified copy though. So I don't know how easy it will be to transfer private changes to the code (fortunately for me, my changes are minimal so I can recreate them if necessary). I also don't yet know how to update my changed code to keep in step with the official code but without losing my changes.

Any help from someone in the know would be most welcome.
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: Git related Questions

Post by Edward-san »

Derp, if you used command line, you could use 'git stash' to save your working copy and remove the changes. After updating the code, you use 'git stash pop' to apply your changes and remove the save.

If you get conflict(s), open the problematic file(s), find them (search the string 'stashed'), save the file(s) and use this command: 'git reset HEAD .' to solve them.
User avatar
Enjay
 
 
Posts: 27115
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Git related Questions

Post by Enjay »

I'm kind of half with you.

So, I make a local clone of the official code,
Edit that manually,
"Stash" the differences somewhere,
Update the clone from the official code (when changes have been made to that),
"Stash pop" my changes back into the clone.

Is that right? I have to say it seems a lot more complex than the way things were done with SVN (where I just edited my local copy and then updated it from the official code allowing TortoiseSVN to automagically handle the merging of changed code with official code - ie each update was just a single click in most cases unless there were conflicts).

TortoiseGit has a "Stash Save" menu option which I guess would do much the same as the command line option but I don't see an obvious equivalent to "Stash Pop". Perhaps it doesn't exist because I haven't stashed anything yet?

FWiW, here's the full TortoiseGit right-click menu...
Spoiler:
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: Git related Questions

Post by Edward-san »

There's also "git stash apply" which doesn't remove the save. I don't use windows, so probably when you use 'stash save' you'll be able to see 'stash apply'...
User avatar
Enjay
 
 
Posts: 27115
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Git related Questions

Post by Enjay »

Is there nothing a bit more seamless? It strikes me as there should be a way for me to say "OK official version, I'd like your changes applied to my own privately modified code please" and just have it work. If SVN can do that, with Git being better, I'd have expected it to be able to handle what must be a pretty common requirement in a simple manner too. It must be there somewhere, no?
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Git related Questions

Post by Nash »

Just reading the posts in this thread is giving me nightmares. I'm not sure I can handle all this. As Enjay said, SVN had it very straight-forward and everything worked so seamlessly and robustly. Looks like I'm going to have a lot of trouble understanding how to work with Git (and resume all of my previous activities under the new system).
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: Git related Questions

Post by Edward-san »

... what happens when you use the 'pull' button in the menu without 'stashing'? (obviously keep a backup copy of your changes)
Blzut3
 
 
Posts: 3211
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: Git related Questions

Post by Blzut3 »

Nash wrote:Why the switch to Git?
Because DVCS is the way of the future. A lot of projects are using either Git or Mercurial now.
Nash wrote:What can it do that SVN can't?
It works offline for one. It's also a lot easier to make your own private repository allowing you to commit even without write access to the main repository. You then can ask for your change with full history to be pulled. Furthermore actual authorship of the commits can be kept.
Nash wrote:Does this also mean there will be git.drdteam.org?
Both ECWolf and Doomseeker use Mercurial and are available on svn.drdteam.org. I'm fairly sure they will forever be known as SVN builds regardless of the actual technology. :P

Personally I would have preferred ZDoom to move to Mercurial since it's much easier for people to transition to (as well as ECWolf, Doomseeker, and Zandronum already using it) along with, in my opinion, better GUIs. But, it was decided to go with the more popular Git.
User avatar
Enjay
 
 
Posts: 27115
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Git related Questions

Post by Enjay »

Edward-san wrote:... what happens when you use the 'pull' button in the menu without 'stashing'? (obviously keep a backup copy of your changes)
I was just wondering the same thing myself but I can't try it ATM. If that works, then it's pretty much the same as how I could update with SVN.

@Nash, I wouldn't take my postings as a barometer for how good/bad/easy/hard the transition to Git is. My biggest problem is that I'm just not familiar enough with the technology and terminology. I'm sure that once the initial transition is made things will work just as well as they did when using SVN, perhaps even better. Of course, I know that you have made far more extensive changes to the source than I have and it seems as if the transfer of those changes may be tricky. I wonder if anything can be done using a patch?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Git related Questions

Post by Graf Zahl »

Why git?
Because it's a lot better than SVN. As Blzut3 said, it works offline, its branching feature is much, much better (in this regard SVN was a nightmare and stopped me from doing lots of experimental stuff) and last but not least, I could make GZDoom a fork of ZDoom so both share the same commit history which makes transferring changes ridiculously easy (as in running 2 operations for an update) And it's faster - a lot faster actually. Comparing with how fast git performs ZDoom->GZDoom merges SVN was slow as a snail.
I would never - ever use a centralized VCS like SVN unless I had no other choice. It's simply an outdated technology.

@Enjay: If you got private changes you may as well commit them to your local copy of the repository. That's another nice thing about DVCS. You got a fully functional local repo on your HD where you can make commits and all.

Regarding Mercurial, in the beginning I wasn't so sure which system would be better. But I have to say that the git tools have significantly improved recently and now TortoiseGit is actually better than TortoiseHg. Git is also the system I use at work so by now I'm more familiar with it.
User avatar
Enjay
 
 
Posts: 27115
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Git related Questions

Post by Enjay »

Graf Zahl wrote:@Enjay: If you got private changes you may as well commit them to your local copy of the repository. That's another nice thing about DVCS. You got a fully functional local repo on your HD where you can make commits and all.
That does indeed sound like a good way to go but all I need to know is how. ;)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Git related Questions

Post by Graf Zahl »

Just commit to it. With TortoiseGit use Right-click/commit. That's a completely local operation. It only goes online if you push it.
User avatar
Enjay
 
 
Posts: 27115
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Git related Questions

Post by Enjay »

Sorry for being so n00bish about this but I'll need to wind back a little because I don't really understand the commit operation. It may seem obvious but what does committing do actually do? Or, more importantly, where does the altered data come from? I'd always assumed that files were somehow imported from elsewhere with a commit, however, that doesn't seem to be my experience with messing around just now.

Here's how I *think* it is working...

I clone the repository from the online GZDoom repository.
I then edit the files in my local copy (thereby making them have red TortoiseGit <!> overlays on them).
I then right-click my local folder and pick Git Commit.
TortoiseGit does some magic and all the <!> symbols become green tick marks and my changes are now considered to be part of the local repository rather than edited files.

Is that correct?
If so, the next time that I update from the online repository and one of the files that I have edited gets updated, will my changes be kept and merged with the updated file or overwritten?
I have to say that I like the TortoiseGit <!> overlays because they let me see at a glance which files I have changed. However, the above steps replace the <!>s with ticks thereby removing the clues about which files I have altered.
Post Reply

Return to “General”