Git help thread

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Nash
 
 
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Git help thread

Post by Nash »

This is all so confusing. I'm going to cry. ;_;

Here's everything I have, and everything I did, in chronological order.

0) Created a GitHub account. Not sure if I need this? I probably do, if I want to sync with the official code?
1) Cleaned up all development/build junk from my GZDoom port. The whole thing is now about 18 MB.
2) Right-click the directory, TortoiseSVN -> Export ... put it on the Desktop for now.
3) Installed mysisgit
4) Installed TortoiseGit

And up to this point, I am completely lost. I really don't know what I'm doing here. :(
Last edited by Nash on Fri May 02, 2014 10:39 am, edited 2 times in total.
User avatar
Nash
 
 
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Re: Nash's SVN -> Git thread

Post by Nash »

Just thought I'd add:

Before this, what I had was basically... my fork in one directory and a pristine copy of GZDoom in another. Every now and then, I'd do TortoiseSVN -> Update on GZDoom, then select all of the entries in the Log and do "Merge revisions to..." and apply them onto my fork. I'd then fix any conflicts or tree conflicts manually (easy to do with TortoiseSVN).

I just want to replicate my previous setup... I don't care about anything else!
User avatar
randi
Site Admin
Posts: 7728
Joined: Wed Jul 09, 2003 10:30 pm

Re: Nash's SVN -> Git thread

Post by randi »

Well, I did a post about this already, but... (keeping in mind that I am not familiar with TortoiseGit, so I can't give you any specific instructions for it)

Your step 0 was unnecessary unless you intend to publish your changes for others.

The first thing you need to do once you have the software installed is clone the repository. This is mostly equivalent to Subversion's checkout. (Note that Git checkout is not the same thing.) The repository page gives you the address to clone. The main difference from Subversion here is that a clone is a complete, fully working copy of the entire repository. Where Subversion is hosted on a central server, the central server on GitHub is just there as a convenient way to get changes to other people but not actually required. The repository you actually work with most is on your hard drive.

If you are not interested in ever building an unmodified copy and are okay with mixing your changes with official ones, you can copy all your changes in there now and periodically pull changes from the original repository and be done with it.

I would suggest you keep your changes in a branch to keep things cleaner. It's also more like what you've got in place now, except that you keep your changes in a separate branch instead of a separate directory. So right after cloning, create a new branch named whatever you like and dump your changes in there. Then commit them. This commit will only go to the copy of the repository on your hard drive. The original repository is left alone unless you push to it. (Since you don't have write access to it, that would fail.) As you make other changes, commit them too. To merge changes from the official repository, you can occasionally pull them and then merge them from the master branch into your new branch.

Using the branch method, the original files and your modifications live in the same directory, but not at the same time. To switch between them, you use a Git checkout. If you've ever used Subversion's switch command, that's what a checkout is like in Git, except much faster, since everything it needs is on your hard drive already. To get the original files, checkout the master branch. To get your changes back, checkout your branch.
User avatar
printz
Posts: 2646
Joined: Thu Oct 26, 2006 12:08 pm
Github ID: ioan-chera
Operating System: Windows 10/8.1/8/201x 64-bit
Location: Bucharest, Romania

Re: Nash's SVN -> Git thread

Post by printz »

Does ZDoom's Git history preserve the former SVN history? How long did it take you to translate SVN to Git? Doing this to Eternity took me half a night on Windows I believe.
User avatar
Nash
 
 
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Re: Nash's SVN -> Git thread

Post by Nash »

Oh whoa whoa whoa wait a minute... I can actually migrate my SVN history over to my Git repo? That means for example, I can revert to SVN r100 of my project? That would be insanely useful. I need to figure out how to do that!

But first... back to my initial struggle. I'm going through your post now Randi... hopefully I won't have any problems!
User avatar
Nash
 
 
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Re: Nash's SVN -> Git thread

Post by Nash »

Okay after carefully doing some manual merging, I'm realizing now that my mistake was that I started working with the latest master.

What I should have done was start my branch with 2.7.0 (where SVN left off) -> dump my stuff into my new branch -> carefully solve any conflicts -> "Pull" from the latest GZDoom repo

In that order... does that look correct?

In any case... how do I find the specific GZDoom version that left off from the SVN? I remember it being r1600 on the SVN. I mean how do I do it with Git? When I do a Clone, it's not like TortoiseSVN where I can type a specific revision number...
User avatar
jpalomo
Posts: 771
Joined: Mon May 17, 2010 9:45 am

Re: Nash's SVN -> Git thread

Post by jpalomo »

You can switch/checkout to a specific version on any of the branches (even ones that you created locally). Right click > TortoiseGit > Switch/Checkout... > Tags > 2.7.0 (this should be the last revision before the switch to Git [5916ce0]) > check 'Create new Branch' and give your branch a new name > Click 'OK' >
Nash wrote:dump my stuff into my new branch -> carefully solve any conflicts -> "Pull" from the latest GZDoom repo
and commit any changes you've made to your branch.
User avatar
Nash
 
 
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Re: Nash's SVN -> Git thread

Post by Nash »

Switching to Tags > 2.7.0 doesn't seem to have the GZDoom-related stuff... only ZDoom's (eventhough I did clone from the GZDoom repo? :S)

I want to go back to GZDoom r1600, specifically. How do I do this?
User avatar
Nash
 
 
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Re: Nash's SVN -> Git thread

Post by Nash »

Nevermind, I think I figured it out. I switched to g1.8.1 and from there I carefully merged my code and fixed conflicts.

Quick question: At what point was Makefile.linux and src/Linux/platform.h removed? I can't find any traces of it in the log (I'm probably just not looking at it hard enough). Is it safe to get rid of this?

Also, shouldn't win32/zdoom.exe.manifest be unversioned? That's a generated file right?
User avatar
printz
Posts: 2646
Joined: Thu Oct 26, 2006 12:08 pm
Github ID: ioan-chera
Operating System: Windows 10/8.1/8/201x 64-bit
Location: Bucharest, Romania

Re: Nash's SVN -> Git thread

Post by printz »

Nash wrote:Oh whoa whoa whoa wait a minute... I can actually migrate my SVN history over to my Git repo? That means for example, I can revert to SVN r100 of my project? That would be insanely useful. I need to figure out how to do that!
Yeah. At TortoiseGit's 'Clone' dialog box you can write a SVN server URL (website). At the bottom of that dialog you see a check box with 'SVN'. You can check it and optionally configure the fields there. You can choose from which SVN revision to start the migration. Beware that in Windows it may take a very long time (it takes no time on Mac and -most probably- Linux), because it stays at each revision for a few seconds.

What will result will be a local Git repository that's synchronized (can push and pull) with a remote SVN one. It won't be as flexible as a true Git — you won't be able to easily merge other stuff into it; you may have to copy the changes — but it will be reliable.

Beware when copying (by traditional means) a Git repository from a Unix-like computer to a Windows computer. If the source package has any executable files (which includes shell scripts), they will perpetually appear as modified in the Windows copy, and you'll be unable to cancel (reset) those 'modifications'. They'll say something like 'mode change 0755 -> 0644' with no changed text inside.
User avatar
Nash
 
 
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Re: Nash's SVN -> Git thread

Post by Nash »

Alright after a lot of hard work, I've finally sychronized to g1.8.1 of GZDoom. I know it's not the latest yet but I need to take this slow.

So I understand the next step is to commit, so that I don't lose my hard work right?

I did Git -> Commit with the TortoiseGit GUI and (after being forced to enter a username and e-mail) I see the familiar commit interface just like TortoiseSVN's. However, the "Commit to" section at the top says (no branch).

I was pretty sure I created my own branch prior to all of this. How do I check for certain what is the currently "activated" branch?

Afraid to proceed until I get further advice... I don't want to lose 2 hours of work...

EDIT:

When I tried to Commit, it says "Current HEAD detached, create a branch?" with Yes, No and Cancel. I hit Cancel because I don't know what's going on.
User avatar
Nash
 
 
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Re: Nash's SVN -> Git thread

Post by Nash »

HAH! I tried to export my changes as a precaution and all of these failed:

1) Exported HEAD - creates a ZIP file of ZDoom stuff
2) Exported (detached from g1.8.1) - ERROR! Git did not exit cleanly
3) Exported isurvivor-win32 (name of my branch) - also creates a ZIP of pristine ZDoom

Well at least my changes are still floating there (with all the red !'s)...

So how exactly do I commit? :S
User avatar
randi
Site Admin
Posts: 7728
Joined: Wed Jul 09, 2003 10:30 pm

Re: Nash's SVN -> Git thread

Post by randi »

Did you create your branch before you switched to the g1.8.1 tag? If so, delete it and recreate it now. The branch starts at whatever point you have checked out when you created it. If you create it now, you can commit to it and have it track your changes.
User avatar
Nash
 
 
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Re: Nash's SVN -> Git thread

Post by Nash »

I'm sure my branch was created because I see "isurvivor-win32" in the tag dropdown list when I tried to export.

I think I know what's going on; I created the branch but I didn't "Switch/Checkout" to it so what has been happening is I was making changes to g1.8.1 which is causing it be (detached from g1.8.1)?

Problem now, I'm pretty sure if I do "Switch/Checkout" to isurvivor-win32, I will lose all of my changes because I remember when I tried to export isurvivor-win32, it produced a ZIP file with pristine ZDoom inside it.

To make things even more complicated, trying to export (detached from g1.8.1) produces an error.

I will try a simple Windows Copy + Paste to preserve my changes but if anyone knows of a better, cleaner way to solve this problem, I'm all ears...

EDIT: Here's how I solved my problem

Looked at http://stackoverflow.com/questions/9705 ... rtoise-git to learn how to delete my branch with TortoiseGit

Created a new branch with TortoiseGi and ticked the checkbox "switch to new branch"

Commit.

Success!

EDIT 2:

Now that my fork is commited, it's time to take it to the next level... and get the latest stuff.

I right-clicked, chose TortoiseGit -> Pull and this happened:
git.exe pull -v --progress "origin" isurvivor-win32

fatal: Couldn't find remote ref isurvivor-win32
Unexpected end of command stream


git did not exit cleanly (exit code 1) (2215 ms @ 05-Jul-13 1:18:40 AM)
User avatar
Nash
 
 
Posts: 17283
Joined: Mon Oct 27, 2003 12:07 am
Twitch ID: nashmuhandes
Github ID: nashmuhandes
Location: Kuala Lumpur, Malaysia

Re: Nash's SVN -> Git thread

Post by Nash »

I tried doing a "Merge" and it applied all of the changes from the latest GZDoom to mine. Unlike TortoiseSVN however, it doesn't prompt me for each conflict and I have to Resolve everything myself after the fact.

Now, however, my port won't build (it errors out at updaterevision) and I have absolutely NO idea how to go back to my previous commit before I did the Merge. Show Log doesn't show me the clean Commit I did (I remember putting "Yay!" in the log... it's not in there). Only the latest (messed up) commit is there.

I'm really on the edge of giving up at this point. :(

Return to “Editing (Archive)”