Nao

  • Dadman with a boy
  • Posts: 16,082
Stupid git?
« on October 23rd, 2013, 09:48 PM »
I'm doing this topic in the public area, in the hopes that:
(1) my issues may be resolved by more people,
(2) anyone can learn, too, and later be able to contribute to the repo when it's made public.

So... Wedge is now a git repo (yaaaaay...), and leaves SVN behind. (I'm not completely finished with it, as I plan to restore revision numbers through either tags or notes, whatever is best, in the future, when I have a bit more time to devote to that.)

Git is a complicated beast to master, and I'm only getting started.

Notably, what needs to be 'understood' is how communicating between repos is made. Since it's not stored on a central server, no repo is the 'right' repo, so I consider the right repo to be my local repo. For all intent though, it's exactly like the BitBucket private repo I have right now, since my 'origin' ref is set to that one.

There are 4 matters that I wish to solve before I can continue. (Maybe 5, but I can't remember the last one, it'll come back to me.)

1/ When doing a pull from my remote origin, TortoiseGit fails because some files I've edited locally were changed in the meantime on the remote repo. It told me to stash my uncommitted changes, but I can't find a stash command in TortoiseGit. So, I fired up SmartGit, and tried to pull from there. It offered me a choice between merging and rebasing. I chose merging as it's the default Git behavior, but they recommend rebasing. However, I want to keep branches, to make it easier to find areas that were pulled from another branch obviously. Apparently, it was the right choice, because my logs are identical between HEAD and origin/master, so it looks like it copied the history straight from the remote origin, right..? Still, I'm lost, I'm not sure what's best for communication between my repos.

2/ In my current situation, I'm pushing my own changes to the remote origin directly, when I could be doing a repo on my account, and then push it to the team account's repo. However, I don't know how to do these pushes manually or automatically, especially on a remote server, so... A bit stuck. FWIW, I don't know how the current collaborators (Pandos and TE) can merge their own branches with the updates on the official repo. Honestly, it eludes me. I need some frigging documentation on that, I guess.

3/ Bitbucket sucks, somehow. They won't allow me to add a fake e-mail address to my account, so I can't associate nao@wedge with my own account. Sucks. Big time. However, since it will end up at github eventually, it won't be a problem, soon. However, my biggest problem is that Bitbucket uses my 'actual' e-mail address for web-based commits (e.g. pull requests), thus I currently have, in the online (private!) repo, my e-mail address in the clear. I don't want that. Github provides no-spam addresses, so I'm okay with that, but BB doesn't have anything. I'm forced to commit with that e-mail address, no way to conceal it.
I tried 'amending' my latest commit, but it didn't work. I don't know if it's because the latest commit is not technically from my git account that I can't seem to actually amend it, or if it's just how it works (doesn't work). I did 'git commit --amend --reset-author' in a bash window, and it simply launched a Vim page with the commit data. I didn't know what to do, so I just closed the window. TortoiseGit didn't offer to amend. SmartGit offered to do it, but I can't seem to make it work. Finally, Git Gui did the amend as I asked, but it didn't change the author at all (couldn't find an option to --reset-author, which probably didn't help.)
Anyone knows how I can fix that particular commit....?

:edit: Actually-- I just restarted my TortoiseGit log (which I'd only 'refreshed'), and it marked the commit as using my dummy e-mail address. Yoohoo! Well, it's still not cool that I'm going to have to amend all of my future pull request merges, but... Well, it's an extra incentive to hurry up and go public, ah ah...!

4/ Right now I have 36 uncommitted files, with three thematic changesets: privacy rewrite, contact list stuff, and miscellaneous one-bits. Is there a way to split these into several branches, so that I can safely work on them separately, and then commit as needed? Or do I absolutely need to create a branch, then start my stuff? I'm guessing I could always 'stash' the changes, then create a branch, then unstash..? (But then I need to selectively stash for each file, which I don't think is possible, ah ah...)

Okay, that's all for now...

I'm a bit annoyed that I've been spending the better part of the last 3 days working on the git innards, instead of actually committing my private rewrites, but... Whatever. I have to do it. It's the only way Wedge can keep up, at this point. It's so easy to do pull requests, I want to enable anyone to do them. I'm just hoping I can live up to it, see..? What's a fantastic git repo, if the maintainer isn't able to do the basic stuff...? :P

TE

  • Posts: 286
Re: Stupid git?
« Reply #1, on October 24th, 2013, 09:12 AM »
Sorry, can't help with SmartGit, Tortoise and such programs.. I'm using Netbeans and I'm quite happy with.. I think it's important to setup and understand the GIT / Github workflow from the beginning.


This is what I did with the openImporter (and other projects):

Setup:
1) created a team account (openimporter) and a repo for the files (named openImoprter, too).
2) Forked the repo with my personal account.
3) Cloned it locally.
4) added the team account repo as upstream
Code: [Select]
git remote add upstream https://github.com/OpenImporter/openimporter.git


Typically Workflow:
1) create a local branch named "xy"
 
Code: [Select]
git branch xy master
2) switch to that branch
Code: [Select]
git checkout xy
3) work on a fix / feature and commit to that branch
4) merge in changes from the team repo
Code: [Select]
git pull --rebase upstream master
5) push the finished branch (and the updated master, if there are updates from upstream) to my remote (origin)
6) send a pull request via github (there's a button once you've uploaded a branch)
7) Merge the pull request (team account)

I use Netbeans with gitbash and the only thing to do via git shell is the init setup (git remote add....) and the rebase
Code: [Select]
git pull --rebase upstream master
Everything else is covered by Netbeans gui.

related to 4). I've never worked with stash .. What I did in the past: copied the modified files to somewhere else, created a branch and moved the files back to that branch, commited the changes.



Thorsten "TE" Eurich - Former SMF Developer & Converters Guru

Pandos

  • Living on the edge of Wedge
  • Posts: 635
Re: Stupid git?
« Reply #2, on October 24th, 2013, 10:10 AM »
Keep my local repo up to date is really boring at this time.
So there are a a lot of changes in my local repo and SmartGitcompletely discard my changes to files I've staged before.
So I have to backup my local repo and merge the changed files after updating from master.

Dunno how to solve it.
Using SourceTree. Perhaps I should give Netbeans a try...
# dpkg-reconfigure brain
error: brain is not installed or configured

forumsearch0r

  • Posts: 118
Re: Stupid git?
« Reply #3, on October 24th, 2013, 08:27 PM »
Using public git hosters is a bit unflexible. Why don't you set up your own git server?

(But great that you're using git now. Better for branch management indeed.)

NetBeans for PHP code? Duh. Use Emacs with Magit and all problems are solved. :-)
(IDEs make smart people stupid.)

Pandos

  • Living on the edge of Wedge
  • Posts: 635

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Stupid git?
« Reply #5, on October 27th, 2013, 10:53 AM »
I'll get to answer the stuff above (thanks!), but I have a quick question...

Let's say I have branch master, and branch newfeature.
If I switch to newfeature, then do changes, then commit half of them, and leave some changes uncommitted...
When I switch back to master, do these uncommitted changes show up in the same files?

My #1 grudge against Git is that it seems to expect from you that you commit every little change you make at any moment. My workflow involves doing changes, and then launching the commit dialog, and regularly launching diffs of my (uncommitted) files to check out the changes I'm working on, and quickly spot what remains to be done. I'm not sure I want to go through the git show log dialog (for previous commits) to do the same; or is it, really, not that big a deal..?

forumsearch0r

  • Posts: 118
Re: Stupid git?
« Reply #6, on October 27th, 2013, 10:56 AM »
Quote from Nao on October 27th, 2013, 10:53 AM
My #1 grudge against Git is that it seems to expect from you that you commit every little change you make at any moment.
Commit yes, push no. ;)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Stupid git?
« Reply #7, on October 27th, 2013, 11:17 AM »
Quote from forumsearch0r on October 24th, 2013, 08:27 PM
Using public git hosters is a bit unflexible. Why don't you set up your own git server?
I don't know what would the point be...
Effectively, the main reason I'm going for git is because everyone's on github.
Also, I severely appreciate the fact that I can keep 'final' control over the codebase, while still allowing for proper crediting in the history. I always hated having to say 'thanks to ...' in the changelog to credit someone. Let's have their name in there! So it can be shown in stats, and things like that!
Quote
(But great that you're using git now. Better for branch management indeed.)
I'm slowly, but very, very slowly, getting used to no longer having rev numbers... <ah, sigh...>
Quote
NetBeans for PHP code? Duh.
Well, they have a PHP module, and it seems to work fine...
I have no idea how TE did his global variable removal through it, though. The various 'code cleanup' plugins don't work, for me.
Quote
(IDEs make smart people stupid.)
I only ever used ONE IDE in my entire life -- Delphi, the Object Pascal editor, which was a fantastic IDE, BTW. When I switched to web development, I used the tool I was most used to -- Notepad, and never really found a reason to use something else.
Now, of course, I use the best tools in each category (grepWin for search/replace, Notepad2 for SDI editing, Notepad++ for MDI editing, TortoiseGit for DVCS...), so I guess no IDE will ever satisfy me, because 'it's missing this feature from that tool...'
Quote from Nao on October 27th, 2013, 10:53 AM
Commit yes, push no. ;)
But branch commits still clutter the log...
My goal with my 'temp branches' is mostly to import the changes once I'm entirely done with them, in a single history commit, and delete the branch. I suppose it can be done, which is why I'm starting to do it, but it's still... A bit complicated, overall. Mind you, it's interesting. But I need more work to get into the git state of mind.
One of the latest issues of .net magazine has a tutorial on git. What's funny is that even in that stupid tutorial 'for absolute beginners', the guy CAN'T HELP but use words like 'detached-head state' here and there... Without even realizing that he didn't care to explain what they are in the first place. Seriously, it's like git documentation is only offered to people who don't need it in the first place. I don't know what I would do without stackoverflow, frankly...!

forumsearch0r

  • Posts: 118
Re: Stupid git?
« Reply #8, on October 27th, 2013, 11:23 AM »
Quote from Nao on October 27th, 2013, 11:17 AM
Now, of course, I use the best tools in each category (grepWin for search/replace, Notepad2 for SDI editing, Notepad++ for MDI editing, TortoiseGit for DVCS...)
dnGREP/Emacs, Emacs, Emacs, git shell ... :whistle:
Posted: October 27th, 2013, 11:21 AM
Quote from Nao on October 27th, 2013, 11:17 AM
Seriously, it's like git documentation is only offered to people who don't need it in the first place.
Linus Torvalds was one of the initiators of git - this might be one reason. :ph34r:

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Stupid git?
« Reply #9, on October 27th, 2013, 04:50 PM »
Quote from forumsearch0r on October 27th, 2013, 11:23 AM
dnGREP/Emacs, Emacs, Emacs, git shell ... :whistle:
What are their killer features..? Any 'plus' that none of the others have?
Quote
Linus Torvalds was one of the initiators of git - this might be one reason. :ph34r:
It only explains the software's name... Not the fact that despite having tons of developers working with it, there's never been a 'git for dummies' version, or anyway, something that would simply rename functions to be in line with usual SVN commands, etc...

TE

  • Posts: 286
Re: Stupid git?
« Reply #10, on October 27th, 2013, 05:56 PM »
Quote
I have no idea how TE did his global variable removal through it, though. The various 'code cleanup' plugins don't work, for me.
It's default setting in netbeans.. Tools-  Options - Editor - Hints

Check the screenshots.. should be self explaing.

 

📎 code_hints.png - 86 kB, 776x685, viewed 328 times.

📎 hints_2.png - 194.1 kB, 1366x768, viewed 400 times.


forumsearch0r

  • Posts: 118
Re: Stupid git?
« Reply #11, on October 27th, 2013, 07:29 PM »
Quote from Nao on October 27th, 2013, 04:50 PM
What are their killer features..? Any 'plus' that none of the others have?
Emacs compared to grepWin (and dnGREP): It is a complete editor with built-in search&replace, not only search&replace; this allows direct editing instead of plain "if this then that" in case of special cases.

Emacs for SDI editing: No GUI clutter, more programming features.

Emacs for MDI editing: Depends.

git shell compared to Tortoise-something: Power at your fingertips, no GUI clicking orgies.
(You could as well use Emacs...)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Stupid git?
« Reply #12, on October 27th, 2013, 09:54 PM »
@forumsearch0r> Seriously, Emacs is broken... The UI is a mess, and it doesn't look like something usable by anyone. I did spend 10 funny minutes playing its embedded text adventure game, though... Lol. As for dnGREP, its UI is even worse, there's absolutely no chance I'm ever gonna use something that looks like it was designed by a kid, but hey... To each their own, I suppose. ;)
Also, its file preview isn't very practical. It doesn't jump to the results, for instance.

@TE> Wow, impressive... Thanks for the hint. I had to disable many things, but it seems to work.
I removed all unused globals from the root folder, I thought you'd done them all..? So, it was just a 'first batch', I suppose..?
One of the interesting ones, I suppose, would be these lines in Load.php...

Code: [Select]
$this_plugindir = $context['plugins_dir'][$plugin_details['id']] = $sane_path . '/' . $plugin;

$this_plugindir is initialized, but never used. I guess I can remove it safely, too. It's even in ManagePlugins.php, too, and once again, not used at all...

forumsearch0r

  • Posts: 118
Re: Stupid git?
« Reply #13, on October 27th, 2013, 10:27 PM »
Quote from Nao on October 27th, 2013, 09:54 PM
The UI is a mess, and it doesn't look like something usable by anyone.
How is the UI (which is configurable!) relevant for editing needs?
Quote from Nao on October 27th, 2013, 09:54 PM
As for dnGREP, its UI is even worse
I actually like it, but it has a couple of glitches indeed. Well, it's a beta.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Stupid git?
« Reply #14, on October 27th, 2013, 10:54 PM »
Quote from forumsearch0r on October 27th, 2013, 10:27 PM
Quote from Nao on October 27th, 2013, 09:54 PM
The UI is a mess, and it doesn't look like something usable by anyone.
How is the UI (which is configurable!) relevant for editing needs?
Well, just look at Wedge itself and you'll know...

The attention to detail is what separates good from great. And really, it can also make life easier on a daily basis. When you have a wide choice available to you, you tend to choose what makes you more productive. For instance, I already documented the fact that Notepad++ (and NetBeans, for that matter) don't have the main window's vertical scrollbar 'stick' to the right of the screen, meaning I have to voluntarily target the scrollbar thumb with my mouse, instead of just targeting its vertical position, and then moving my mouse to the extreme right of the screen, ensuring it'll respond to my clicks. It doesn't seem like much, but I systematically work like this, moving my mouse to the right, then going up or down until the thumb gets 'highlighted', and then I'll click and drag the thumb. It's important, to me, that software behaves the way I need, or that it can be configured to do so.
The same applies to browsers, BTW. And Opera did it that way. Chrome, too (although these days, until Opera implements vertical tabs, I'm using a Chrome add-on that adds vertical tabs, but also prevents the window from being maximized; it's a shame, but I'm dealing with it until times get better.)
Quote
I actually like it, but it has a couple of glitches indeed. Well, it's a beta.
An old one, too...