Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

08-30-2018 , 02:13 AM
Quote:
Originally Posted by :::grimReaper:::
Let n be the number of commits you want rollback.

git reset HEAD~n
git stash
git push origin --force
git stash pop

Communicate this to anyone else working on the branch, otherwise they may introduce your old stuff.

Also, I've never used git revert, so unsure if there's a better way using that.
Oh and the two stash commands aren't necessary at all. I just rarely push with dirty files lying around.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 03:28 AM
Quote:
Originally Posted by :::grimReaper:::
#1 sounds awful wtf. The feature/project can't be broken down and attacked in parts? Only once have I shared a branch with another dev, and it was a massive branch.
That's how it started. I think what end up happening (and actually happened last week) was people got lazy (what a shocker!) and rarely merged in other branches so, when it came to trying to merge feature branches back into master it introduced merge madness and lots of bugs. My manager asked me to merge the main dev branch into a branch I was working in that was a bit of A/B testing for an existing page. Last week, two members of my team took turns introducing an influx of bugs into the main dev branch. I told my manager I would not merge the main branch in until **** settled down and we were pretty sure all the introduced bugs were fixed. I told him that on Friday with pretty strong language. Monday morning of course he asked to merge it in. It broke a number of things and caused me to do my first ever git revert for a merge.

I think when I say merging you are interpreting that as a merge request. Nobody in my team ever submits a mr for someone else to approve. By default, I only do mr's when I'm resolving a bug. That mr gets assigned to my team leader, who starts a stage push, tested, then included in next deployment. Typically, when I say merge (and might apply to other people) I mean something like
Quote:
git merge [someone elses branch]
Quote:
Originally Posted by :::grimReaper:::
Funny you ask, my boss complains I submit too many MRs. Today I asked him to merge something small I pushed yesterday, and he jokingly asked, "You expect something you pushed yesterday to be merged today?" I responded, "I expected it to be merged yesterday." Everyone laughed.

Anyway, I have small branches that I start and submit the same day to merge, and branches that take weeks, and everything in between.
My general rule is to try and merge all my active branches at least once a week on Friday. I currently have 3 active branches that are distinct from the main dev branch. Since the main dev branch is ****ed right now, I've only been merging master in lately.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 05:56 AM
Quote:
Originally Posted by suzzer99
Total nitpick but one thing I didn't like is separating a block of single use code out into another function just to make it read easier. Just leave it inline imo.
I'm totally with you there, and I don't think it is a nitpick.

Creating little functions all over the place that encapsulate short bits of code is not more readable. The more I have to jump around in the code to figure out what it is doing, the more confusing it gets.

Sure, you might remember right now, while writing the code, what parse(data) does. But when someone else encounters that code, they won't know, they won't even know if it is located in this module or not, and will have to jump around in the codebase to figure it out.

Last edited by Wolfram; 08-30-2018 at 06:10 AM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 06:02 AM
Quote:
Originally Posted by suzzer99
Thanks I'll check out some of those git strategies. Undo last commit is what I want - but it's not that simple I've found. I always try SourceTree reverse commit and revert commit and neither do exactly what I want. Then I get in trouble and almost lose my changes.

As far as our gitflow - basically master always represents what's in prod. We don't merge to master until after we put a release branch in prod and we're completely happy with it - like days later.

We may have lots of long-lived feature branches and a few long-lived release branches in development at any time. It's the responsibility of leads to constantly pull in master and
possibly other relevant branches that are scheduled to go into production prior to the one their working on.

Devs have their development branch(es) and it's their responsibility to always pull in the feature or release branch they're working on. Dev branch names are of this form: dev-suzzer-release-012209, dev-suzzer-supercoolnewfeature, dev-suzzer-bugfix10777, etc. This allows us to periodically prune old orphaned branches that start with "dev-".

Note this is monster website with a lot of manual smoke-testing and deploy steps. So YMMV.

One nice thing about release branches is if we found out something broke like 2 weeks after the release, I can do a dummy pull request (DMN- = DO NOT MERGE) between the previous release and the current one and scan over the diff for possible culprits. I guess you can do this with tags (which we hardly used but probably should have). But I really like the visual onsite diff of pull-requests, and ability to add comments, etc. Maybe I can still get that with tags?
undo last commit is just a soft reset. hard reset will undo the commit and lose the changes.

"git reset --soft HEAD~1" where 1 is the number of commits to undo. so if its just your last commit, use 1. then you can stash that commit and you will always have those changes. this is a pattern I use a lot.

also, if you have EVER committed something, no matter what you do, you will almost always be able to get it back with a "git reflog". I say almost bc I am sure there are ways to mess it up but if you just undo the commit and then undo your changes or much up your changes or even do a hard reset, you can still just use the git reflog id to checkout that detached version. then do a git soft reset and bam your changes are no there in uncommitted state.

revert commit is strange in my experience and I avoid it. it creates a whole new commit that gets rid of your changes of the commit you specify. so I dont think it will do what you want bc it will never you leave you with your uncommitted changes existing. to do that you need to do a "git reset" at some point. I guess revert is nice bc it will leave in the history of the master branch the old changes so any developer can get to them (with a git checkout <commitId> then git soft reset last commit) so I can see why the revert makes sense to maintain the history. also, revert can undo a commit from long ago if necessary.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 06:07 AM
Quote:
Originally Posted by :::grimReaper:::
Let n be the number of commits you want rollback.

git --soft reset HEAD~n
git stash
git push origin --force
git stash pop

Communicate this to anyone else working on the branch, otherwise they may introduce your old stuff.

Also, I've never used git revert, so unsure if there's a better way using that.
and you dont need to stash (tho I would use your pattern so that the changes exist in stash) bc you can push with uncommitted changes and it acts like they dont exist.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 06:10 AM
Quote:
Originally Posted by :::grimReaper:::
And I'm in favor of 80 column sizes, because code doesn't wrap on tiled terminals. It's also enforced at where I work.
+1

Your editor/ide of choice might support huge columns of code fine, but you never know how your code will be reviewed or presented in the future. 80 is guaranteed to be readable basically in any screen or printout.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 06:14 AM
Quote:
Originally Posted by :::grimReaper:::
#1 sounds awful wtf. The feature/project can't be broken down and attacked in parts? Only once have I shared a branch with another dev, and it was a massive branch.



Funny you ask, my boss complains I submit too many MRs. Today I asked him to merge something small I pushed yesterday, and he jokingly asked, "You expect something you pushed yesterday to be merged today?" I responded, "I expected it to be merged yesterday." Everyone laughed.

Anyway, I have small branches that I start and submit the same day to merge, and branches that take weeks, and everything in between.
does your boss, or anyone, need to review your branch before merge? bc in my experience, many small branches/PRs/commits is like a million times easier on reviewers then sporadic massive changes to review.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 07:39 AM
Thanks for sharing that much of info and knowledge here it really helps me alot it may also help others
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 08:34 AM
Quote:
Originally Posted by RustyBrooks
I don't know why except that it used to be very common for tab stops to be set to 8 characters so all the old dudes were used to it that way.
I believe it's a hangover from manual typewriters with fixed tab stops at every 8 characters, that were seen as the best compromise for creation and formatting of tables.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 10:49 AM
Quote:
Originally Posted by Victor
does your boss, or anyone, need to review your branch before merge? bc in my experience, many small branches/PRs/commits is like a million times easier on reviewers then sporadic massive changes to review.
Yes and yes. I think they just like giving me a hard time.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 10:51 AM
Quote:
Originally Posted by codeartisan
I believe it's a hangover from manual typewriters with fixed tab stops at every 8 characters, that were seen as the best compromise for creation and formatting of tables.
Maybe it's a punch card thing lol.

When I went to college there was a professor who had a story about dropping his giant box of punch cards for his big year-long assignment. It took him days to put them all back in order.

You kids and your fancy 80 column screens don't know how good you have it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 01:12 PM
Quote:
Originally Posted by suzzer99
Yeah devops is a great field to get into right now. Everything is changing so fast that experience isn't as important.

Funny thing is I've always been the opposite - I just want to code and avoid all that gnarly system stuff. But DevOps with cloud has kind of met me half way. At least I don't have to worry about **** like how to install gcc 10.2 on Ubuntu 4.2.0 and make sure chmod is right and my PATH is correct and my process is in background mode and whatever other painful crap.
The system stuff is challenging. No issue is ever alike and there are always 50 ways to do things and you need to try to pick the best one, it’s interesting

Re: 80 chars, i’m almost positive this goes back to punch cards and then early terminals being designed around this col length.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 01:17 PM
I think its weird to limit yourself to 80 characters given todays technology. But, meh, whatever.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 02:02 PM
Quote:
Originally Posted by jmakin
Re: 80 chars, i’m almost positive this goes back to punch cards and then early terminals being designed around this col length.
The IBM punched card format (introduced in 1928!) was 80 columns wide

Most of the first displays were either 40 or 80 columns wide.

ETA: there were other formats but 80x12 was one of the first standards. The first displays I remember using were 80x24, and I bet the 24 height was because it was a multiple of 12.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 02:20 PM
Quote:
Originally Posted by suzzer99
What happens if there's a name conflict? I guess all go packages must have unique names?
No - you can rename packages on import, i.e.

Code:
import xgoloader "golang.org/x/tools/go/loader"
Quote:
Originally Posted by suzzer99
Is 8-space tabs some kind of Go thing? https://github.com/sipt/shuttle/blob/master/model.go - second repo I've seen like this.

If so I'm out. I'd rather make hats on the beach.
The gofmt tool, which is pretty widely used, inserts tab characters for indentation. I would guess 8 spaces is just Github's rendering of a tab character. I use 4 in my IDE.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 02:22 PM
Quote:
Originally Posted by :::grimReaper:::
And I'm in favor of 80 column sizes, because code doesn't wrap on tiled terminals. It's also enforced at where I work.
Quote:
Originally Posted by Wolfram
+1
GROSS. DO NOT WANT.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 03:06 PM
80 is a good idea for commit messages but otherwise what goofy said
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 03:52 PM
This brings me back to a years-old discussion (incidentally, with the same coworker who started the Go repositories thing above) about line breaks in Git commit messages. He included this (from Linus Torvalds) in his favor: https://github.com/torvalds/linux/pu...omment-5661185

Quote:
On Fri, May 11, 2012 at 1:49 PM, Daniel Nugent
reply@reply.github.com
wrote:
I'm not sure I understand why the commit message itself should be hard word-wrapped. Naively, it seems like that should be a display property of the editor used to write the commit message or the tool used to display the commit message.
No it shouldn't.

Word-wrapping is a property of the text. And the tool you use to
visualize things cannot know. End result: you do word-wrapping at the
only stage where you can do it, namely when writing it. Not when
showing it.
"Word-wrapping is a property of the text (!!!!) and you should do it when you write it" strikes me as an indefensibly stupid and false statement, but that's just me.

Adding line breaks to writing is obviously different from line breaks in code, mostly this just reminded me about the humorous things that occasionally come out of the Church of Linus.

(I also love that even just pasting this here, the guy he's responding to has normal looking text while Linus' message is in this broken choppy format because of what he believes to be a superior method of communication)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 04:00 PM
He's basically arguing against word processors in favor of typewriters.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 04:02 PM
So Chrome (on Mac at least) has a fun new bug. Close a tab (or it could be closing a tab in separate window by closing the window), then switch to another tab. For a brief flash it displays the tab you just closed. Even if that tab/window was an incognito window you were using for certain things. Fun stuff.

Not always obviously but I've seen it a lot now.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 04:10 PM
Quote:
Originally Posted by goofyballer
GROSS. DO NOT WANT.
Quote:
Originally Posted by jjshabado
I think its weird to limit yourself to 80 characters given todays technology. But, meh, whatever.
It's not a technology thing, it's a readability thing. Code should flow vertically, not horizontally. And as I mentioned, if you multiple tiled terminals up, wrapped code everywhere is very unreadable.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 04:13 PM
Quote:
Originally Posted by :::grimReaper:::
Code should flow vertically, not horizontally.
Luckily, expanding to, say, 110 columns (I think that's Github's web UI limit for diffs, so that's what we use) has not inspired anyone, in my professional experience, to try using all this glorious extra space to jam multiple lines of code into one line, or anything of that nature. Our code still all flows vertically, even if some lines are long!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 04:14 PM
Quote:
Originally Posted by Victor
revert commit is strange in my experience and I avoid it. it creates a whole new commit that gets rid of your changes of the commit you specify.
Just read up on git revert, and I agree. The only place where I can imagine using it is on a protected branch. Better to simply delete or ammend the commit.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 05:38 PM
Goofy or any Golang folks, anyone tried VGo out yet?

I can't get my own sub packages to work. Meaning:

main. go
foo/Foo.go

How does one import foo package into main?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
08-30-2018 , 05:52 PM
Quote:
Originally Posted by goofyballer
Luckily, expanding to, say, 110 columns (I think that's Github's web UI limit for diffs, so that's what we use) has not inspired anyone, in my professional experience, to try using all this glorious extra space to jam multiple lines of code into one line, or anything of that nature. Our code still all flows vertically, even if some lines are long!
Yeah, I mean we're talking 30-40 columns here. Although we don't use strict line limits, some lines go to like 160 columns!!!!, and I've never heard any problems about readability.

I've never really had a problem with line length (or anything related to it) but if anything short lines seem to force people to use short variable names which ends up making code less readable.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m