News for hackers. Stuff that matters.
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @03:38PM (#11037021)
I linked to the free online version because that feels like the more HN thing to do, but there's also an announcement post that includes a 15% launch discount on ebook sales:

http://news.railstutorial.org/learn-enough-git-ebooks/

I'll plan to be around for a bit this afternoon in case anyone has any questions. I've already gotten a lot of great feedback on Learn Enough™ Git to Be Dangerous, so thanks for all the support!

Re:Learn Enough Git to Be Dangerous by skizm on Thursday February 04, 2016 @05:27PM (#11037803)
Wait... The phrase "Learn Enough" is trademarked? Wtf?
Re:Learn Enough Git to Be Dangerous by tdb7893 on Thursday February 04, 2016 @05:46PM (#11037895)
They probably use it for all their books. It would be like "for Dummies" being trademarked, which I feel is pretty reasonable
Re:Learn Enough Git to Be Dangerous by wmboy on Thursday February 04, 2016 @08:52PM (#11038838)
™ stands for Trademark Pending

® stands for Registered Trademark

Absolutely anyone can create a term and put ™ after it (even if they never actually go through with the actual registration process).

Re:Learn Enough Git to Be Dangerous by lwf on Thursday February 04, 2016 @10:07PM (#11039136)
In the United States at least, ™ doesn't mean "pending" per se — you can use ™ even when you have a registered mark, and marks do not need* to be registered to be valid:

> Is registration of my mark required?

> No. You can establish rights in a mark based on legitimate use of the mark.

http://www.uspto.gov/trademarks/basics/register.jsp

*: Some countries operate under a first-to-file system, and unregistered trademarks may be at risk even for US-based businesses that operate internationally.

(I am not a laywer and this is not legal advice.)

Re:Learn Enough Git to Be Dangerous by ajmurmann on Friday February 05, 2016 @12:55AM (#11039792)
Even if they have the trademark it's reasonable. You just can't use it for a product that might be confused with theirs by a reasonable person. Do you can still make ice cream called that way or probably even name your next novel like that. Just no tutorials on the tech area.
Re:Learn Enough Git to Be Dangerous by mrsharpoblunto on Sunday February 07, 2016 @03:16PM (#11054597)
It also depends if they have registered the trademark on the principal or supplemental registers. Trademarks which are descriptive in nature (such as this one) often can't get on the primary register (though they may after extensive use that results in the mark acquiring a secondary meaning). If a trademark is registered on the supplemental register it doesn't afford the owner the right to exclusive use of that mark - even for similar products. All being on the supplemental register gets you is the right to prevent other similar trademarks being registered.
Re:Learn Enough Git to Be Dangerous by Terr_ on Thursday February 04, 2016 @10:18PM (#11039177)
Sure. In an ideal-sane-world, it just means they're calling "dibs" on using it as a motto or tagline for instructional material.
Re:Learn Enough Git to Be Dangerous by petercooper on Thursday February 04, 2016 @06:24PM (#11038086)
I've often checked things in USPTO's search system (TESS) to see if they're trademarked before I use them, and this isn't coming up for me. Anyone got any insight(?), as if it is trademarked, all my other searches over the years have been similarly inaccurate and pointless :-D
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @06:38PM (#11038152)
What you're seeing is the difference between trademarks™ and registered trademarks®. The USPTO lists the latter but not the former. You don't actually have to register a trademark in order to use it, but it's usually a good idea. Which reminds me: now's probably a good time to drop a line to my lawyer…
Re:Learn Enough Git to Be Dangerous by petercooper on Thursday February 04, 2016 @06:41PM (#11038169)
Aha! Found more info on this topic at http://www.uspto.gov/trademarks/basics/register.jsp if anyone's interested.
Re:Learn Enough Git to Be Dangerous by Riod on Thursday February 04, 2016 @06:23PM (#11038081)
Awesome! I've recommended your ruby tutorial to lots of newbies. Hands down the best out there. Looks like this is another high quality product.
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @06:55PM (#11038264)
Thanks! Glad to hear it. :-)
Re:Learn Enough Git to Be Dangerous by Tamle1012 on Thursday February 04, 2016 @06:43PM (#11038186)
Do you happen to know/recommend a Python book written in a similar style?
Re:Learn Enough Git to Be Dangerous by Riod on Thursday February 04, 2016 @07:03PM (#11038304)
If the Ruby tutorial is any indication, Michael's book will be the best when it comes out. Never gone through any Python tutorials but I've heard good things about: http://www.djangobook.com/en/2.0/index.html, and https://www.twoscoopspress.com/. Take the recommendation with a pinch of salt because I've never done them myself.
Re:Learn Enough Git to Be Dangerous by SSLy on Friday February 05, 2016 @04:38AM (#11040470)
Yeah, but these are books for Django, not general python.
Re:Learn Enough Git to Be Dangerous by Riod on Friday February 05, 2016 @01:07PM (#11043321)
Given that Michael's book is 90% about using Rails, I understood the asker's question to be related to using the framework more so than the language itself.
Re:Learn Enough Git to Be Dangerous by m0nty on Friday February 05, 2016 @05:31AM (#11040603)
Although, that's not a bad way to learn Python. It's how I started.
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @06:58PM (#11038278)
I'm better known nowadays as a Rubyist, but in fact Python was the first language I really loved, and I have over 100K lines of Python under my belt from my Ph.D. research and my first startup. Our planned intro sequence includes Learn Enough™ Ruby to Be Dangerous, but I'm hoping to design it so that I can quickly make a Python version as well.
Re:Learn Enough Git to Be Dangerous by rorykoehler on Friday February 05, 2016 @02:08AM (#11040049)
Among my peers people usually come from a lower level language to either Python or Ruby but rarely switch from one to the other. What made you switch from Python to Ruby?

Also your book set me on my way with Ruby and Rails. I recommend it at least once a week. Thanks for everything.

Re:Learn Enough Git to Be Dangerous by mhartl on Friday February 05, 2016 @09:28PM (#11046223)
What made you switch from Python to Ruby?

Rails. In Python-land, Django hadn't won yet. (My first startup used a half-baked framework I wrote myself on top of Zope. I shudder at the memory.)

Also your book set me on my way with Ruby and Rails. I recommend it at least once a week. Thanks for everything.

You're very welcome! Glad to hear it. :-)

Re:Learn Enough Git to Be Dangerous by BWStearns on Thursday February 04, 2016 @06:51PM (#11038230)
I don't know one in a similar style, but if you're looking to learn Python as a first programming language I highly recommend https://www.udacity.com/courses/cs101

As far as I remember it it had good pacing and by the end of it I could write useful code (albeit initially brutishly ugly code that I will deny ever having written lol).

Re:Learn Enough Git to Be Dangerous by rollover on Friday February 05, 2016 @06:24AM (#11040782)
Test-Driven Development with Python by Harry Percival is kind of a Python/Django equivalent to the Ruby/Rails Tutorial. http://chimera.labs.oreilly.com/books/1234000000754
Re:Learn Enough Git to Be Dangerous by beau26 on Thursday February 04, 2016 @06:17PM (#11038060)
The presentation of this ebook is incredible. Really nicely done. I assume it's custom? :D
Re:Learn Enough Git to Be Dangerous by Anjin on Thursday February 04, 2016 @06:38PM (#11038156)
Thanks! (I did all the UI)

It is all custom, and the Learn Enough series is using a variation on our web book layout that we created for the parent platform http://www.softcover.io - which is what is hosting the Rails Tutorial.

Re:Learn Enough Git to Be Dangerous by tvararu on Saturday February 06, 2016 @05:33AM (#11047220)
I actually learned enough git to be dangerous by reading "Learn Rails by Example." And some TDD, and some Heroku, and some Bootstrap, all as side-effects from the main dish. Quite an eye-opener.

Thank you for all your work!

Re:Learn Enough Git to Be Dangerous by VeilEm on Friday February 05, 2016 @12:40AM (#11039740)
Did they pay Randall Munroe to use his comics? Just curious.
Re:Learn Enough Git to Be Dangerous by mhartl on Friday February 05, 2016 @11:45PM (#11046586)
Randall is pretty chill about people using xkcd strips as long as you aren't selling them commercially:

https://xkcd.com/license.html

I do offer ebook sales, but of course I'm not selling the individual strips themselves, and the online version is free. Still, your comment has made me realize it's probably a good idea to double-check, so I'll probably drop Randall a line just to make sure.

Re:Learn Enough Git to Be Dangerous by Razengan on Friday February 05, 2016 @05:41AM (#11040636)
Thank you so much for writing these. I already owe a lot to your Rails Tutorial. Any plans to make these available on the iBookstore?
Re:Learn Enough Git to Be Dangerous by sytse on Thursday February 04, 2016 @05:11PM (#11037712)
Looks awesome! Thanks so much for making this.
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @05:14PM (#11037726)
Thanks! By the way, in the collaboration section I wanted to tell people about the option to host their own repos, so of course I put in a link to GitLab:

http://www.learnenough.com/git-tutorial#sec-collaborating

Re:Learn Enough Git to Be Dangerous by sytse on Thursday February 04, 2016 @05:30PM (#11037823)
Thanks, I put in a link to your tutorial from our /getting-help section https://gitlab.com/gitlab-com/www-gitlab-com/commit/1fef9f12...
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @05:45PM (#11037884)
Great, thanks! And linking directly to the commit—now that's thinking Git. :-)
Re:Learn Enough Git to Be Dangerous by breakingcustom on Thursday February 04, 2016 @05:21PM (#11037767)
There are just some people in this world that have the reputation and thoroughness that makes you only want to learn new things from that one person. Hartl is one of the few. Thanks and can't wait for the rest!
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @06:07PM (#11038007)
Wow, thanks! Would you mind shooting me an email (address in profile)? I might like to include this comment as part of a testimonial section at some point.
Re:Learn Enough Git to Be Dangerous by dEnigma on Friday February 05, 2016 @03:18AM (#11040247)
The initial delay when opening the site, before the text appears below is very confusing, at least to me. I didn't know if I was supposed to click on something and tried scrolling up and down to trigger something. The delay lasted more than five seconds on first load and about 3-4 seconds on reloads (could be a problem on my end too).
Re:Learn Enough Git to Be Dangerous by mhartl on Sunday February 07, 2016 @06:19PM (#11055488)
Thanks for the heads-up. We'll look into ways to speed things up in future releases.
Re:Learn Enough Git to Be Dangerous by soared on Friday February 05, 2016 @10:08PM (#11046350)
That page is 9.2MB. Would've been smart to have a landing page or paginate.
Re:Learn Enough Git to Be Dangerous by wodenokoto on Thursday February 04, 2016 @04:20PM (#11037325)
I've been looking forward to this one. Learn enough command line to be dangerous is the best beginners guide to bash I've seen and it really made me a lot more comfortable working with cli programs.
Re:Learn Enough Git to Be Dangerous by sharkjacobs on Thursday February 04, 2016 @04:35PM (#11037440)
I just skimmed the first section of Learn Enough Command Line and discovered you can hold option to use the mouse to insert the cursor in the middle of a line.

I thought I knew how to use cli but now I feel like I need to go through this whole tutorial to see what other incredibly obvious things I've been missing.

Re:Learn Enough Git to Be Dangerous by collyw on Friday February 05, 2016 @03:09AM (#11040223)
I would say thats a Unix specific thing more than CLI. It will work on Linux web browsers. Unfortunately three button trackpads seem to be disappearing.
Re:Learn Enough Git to Be Dangerous by Freak_NL on Friday February 05, 2016 @08:18AM (#11041157)
Most Linux distributions by default configure the track-pad to emulate the middle mouse by clicking the left and right button simultaneously. Not as nice as an actual third button, but useful if you are on a laptop without a peripheral mouse attached.
Re:Learn Enough Git to Be Dangerous by collyw on Friday February 05, 2016 @05:00PM (#11044971)
Last couple of laptops I have had were not able to click left and right together. Another one for aesthetics versus usability.
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @04:45PM (#11037509)
Thanks! As the first title in the Learn Enough sequence, Learn Enough™ Command Line to Be Dangerous was especially challenging to write, because it literally assumes no prerequisites other than general computer knowledge (not even a text editor). So glad to hear you liked it!
Re:Learn Enough Git to Be Dangerous by BWStearns on Thursday February 04, 2016 @04:01PM (#11037191)
I really like this series because of the focus on developing technical sophistication as opposed to a narrow set of boxes to check. I've shared the enough command line to be dangerous with a friend who has flirted with the technical and I think it helped him develop the meta skill of technical sophistication more than any specific command line skill. It's a greater achievement than him knowing the all the flags for tar, because who does?

In any case, looking forward to reading through it and thanks for putting these out there!

Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @04:13PM (#11037263)
Thanks! Developing the theme of technical sophistication has been one of the most surprising and gratifying side-effects of making tutorials designed for complete beginners. I'm hoping to continue the theme in each subsequent Learn Enough tutorial, and I'm thinking of adding it to the next edition of the Ruby on Rails Tutorial as well.
Re:Learn Enough Git to Be Dangerous by BWStearns on Thursday February 04, 2016 @04:47PM (#11037525)
Please do! It really struck me as a theme that I hope grows beyond a Hartl-only concept. It succinctly describes a previously unnamed concept. It's the thing that you want to impart when you get that exasperated feeling trying to explain over the phone to a non-technical friend/relative how to go about fixing something that you yourself don't explicitly know how to fix but could easily if you were sitting at their computer.

More broadly have you though about a generic way to achieve/impart technical sophistication intentionally other than as a side effect of getting scraped knees doing technical things?

Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @04:56PM (#11037602)
More broadly have you though about a generic way to achieve/impart technical sophistication intentionally other than as a side effect of getting scraped knees doing technical things?

I don't think there's any way to avoid getting a few battle scars, but just knowing about the idea of technical sophistication (and having a name for it) turns out to be a huge help, as you observed.

Re:Learn Enough Git to Be Dangerous by ryderm on Thursday February 04, 2016 @06:21PM (#11038077)
I can't speak for this book, but Michael Hartl's rails tutorial is what got me addicted to programming, and is largely responsible for me switching majors to CS during my undergrad and getting into the industry. He is a great technical author. Give him your money.
Re:Learn Enough Git to Be Dangerous by noer on Thursday February 04, 2016 @05:49PM (#11037907)
Out of curiosity, why do you use suggest using github in this book, but bitbucket in rails tutorial?
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @05:54PM (#11037934)
Excellent question. The main reason is that GitHub is great for free public repos, which I generally like having as the default, and using GitHub also enables a Secret Bonus™ at the end of the Git tutorial. When it comes to web apps, though, it's better to err on the side of security, so in that case I recommend using free private repos at Bitbucket. (These choices were made mainly because public repos are free at GitHub and private repos are free at Bitbucket. Both services are great and are definitely worth paying for, but in a free online tutorial I prefer to recommend things that are also free.)
Re:Learn Enough Git to Be Dangerous by nickjj on Thursday February 04, 2016 @07:08PM (#11038337)
Hi Michael,

This is the first I've heard of the softcover platform.

After some research it looks like it was posted on HN about 2 years ago, but there's only a handful of books posted on the platform compared to let's say leanpub who has a few thousand.

Since you just posted this book on softcover, it's safe to say you're still happy using it, but why aren't more authors choosing your platform?

You would think after 2 years it would have gained traction, especially considering how big your reach is from previously successful tutorials and books.

I'm a content author and softcover looks nice. My main issue with leanpub is that all sales data is anonymous and you can't obtain e-mail addresses of your readers and your platform seems to solve that.

Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @07:21PM (#11038398)
Thanks for the note. Softcover is absolutely amazing for my purposes, but at this point we think the educational market is more promising than the market for self-publishing tools, so that's what we're focusing on now. This was always part of our plan; I personally needed Softcover for the reasons you mention, but it was an open question whether it would take off as a standalone platform or whether we would end up focusing on making our own products.

A happy but unintended side-effect of making a platform is that it dramatically lowers the barrier to collaborating with other authors, and I'm currently working with several other people on more advanced and varied Learn Enough tutorials. This sort of collaborative publishing (with full control over the publication pipeline) would be effectively impossible without Softcover.

Re:Learn Enough Git to Be Dangerous by nickjj on Thursday February 04, 2016 @07:34PM (#11038469)
I see, thanks for the reply.

So basically you've been spending your time and resources on creating the books rather than promoting the platform?

I will certainly reach out to you in the future because having access to e-mails is enough to move me off leanpub. In leanpub's defense they are a great bunch of people. I've had a number of conversations with their developers and they are always on the ball. Also never had any technical issues with their platform as an author.

Re:Learn Enough Git to Be Dangerous by amai on Friday February 05, 2016 @05:36AM (#11040623)
The new design of the "Learn Enough" series looks very nice. Will Softcover.io also take over this new design for its books?
Re:Learn Enough Git to Be Dangerous by mixmastamyk on Thursday February 04, 2016 @09:09PM (#11038917)
Hmm, both services look nice but don't appear to support Sphinx. Would that be a possibility at some point?
Re:Learn Enough Git to Be Dangerous by aidanf on Friday February 05, 2016 @04:28AM (#11040442)
I used softcover for writing http://books.aidanf.net/learn-swift

The software is awesome for the purposes of writing the book. The reason I didn't go with softcover as a selling platform is that the new EU VAT rules came in and as a result I had to use someone that supported those new VAT collection rules.

So I ended up using softcover to generate the ebooks and html, but using gumroad (and leanpub) to sell them. So it's totally feasible to use softcover for writing your book but self-host the resulting html and keep control of your sales data etc.

Re:Learn Enough Git to Be Dangerous by nickjj on Friday February 05, 2016 @07:22AM (#11040936)
Does this only effect you if you're collecting income from EU or would it be a problem to even accept payments from people living in EU?
Re:Learn Enough Git to Be Dangerous by aidanf on Friday February 05, 2016 @07:37AM (#11040985)
In theory, if you are selling to customers in the EU you are supposed to collect VAT from your EU customers and make the appropriate VAT return to the VATMOSS authorities. Or else stop selling to EU customers.

In practice, if you're based outside of the EU then you can probably just ignore these regulations (many smaller US sellers seem to be taking this approach). It's hard to imagine the EU tax authorities chasing you down.

Re:Learn Enough Git to Be Dangerous by nickjj on Friday February 05, 2016 @07:56AM (#11041055)
Ok thanks. It sounds like this should be something your payment provider (softcover via proxy through Stripe or whatever they use) would take care of for you.

Other platforms that sell items globally tend to charge EU customers more which probably account for the VAT increase, but in the end gives the author roughly the same amount per sale?

Re:Learn Enough Git to Be Dangerous by aidanf on Friday February 05, 2016 @08:41AM (#11041268)
Yes, a lot of sales platforms now handle EU VAT. I've used Gumroad, Sendowl and Leanpub and they all handle the EU VAT problem. In each case the author sets a price. They then detect if the customer is in an EU country and apply the VAT rate for that country, adding it on to the customers total. So the author gets the same amount for each sale, but the customers pay different amounts depending on which country they are in.
Re:Learn Enough Git to Be Dangerous by noer on Thursday February 04, 2016 @05:09PM (#11037697)
I'm a fan of the "Learn Enough..." series. I've found them to be written in a really approachable way, ditto on rails tutorial. Great job!
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @05:48PM (#11037904)
Thanks!
Re:Learn Enough Git to Be Dangerous by jakub_g on Friday February 05, 2016 @05:17AM (#11040569)
This series looks very interesting and hitting the sweet spot with high knowledge density while still being casually readable.

Very nice of the author to put stuff on the website without the paywall.

Two semi-related links (though much different, focusing mostly on syntax):

https://learnxinyminutes.com/

http://hyperpolyglot.org/

Re:Learn Enough Git to Be Dangerous by moomoos891 on Thursday February 04, 2016 @06:45PM (#11038197)
I love you Michael Hartl!
Re:Learn Enough Git to Be Dangerous by nickpsecurity on Friday February 05, 2016 @12:06AM (#11039596)
A previous thread and its uptake in FOSS showed I really need to get a grasp on Git soon. I'm more about practice than theory so I certainly liked this line:

"focuses on Git essentials without getting bogged down in lots of heavy theory."

Bookmarked it for later when I tackle that. Thanks ahead of time for writing and sharing it.

Re:Learn Enough Git to Be Dangerous by gerbilly on Thursday February 04, 2016 @07:27PM (#11038428)
>Learn Enough Git to Be Dangerous

$ git init

Re:Learn Enough Git to Be Dangerous by dave2000 on Friday February 05, 2016 @03:53AM (#11040346)
Is there supposed to be a free book here? The page doesn't work on mobile; I zoom in and a rectangle on the left pointlessly expands, covering the screen.
Re:Learn Enough Git to Be Dangerous by dave2000 on Friday February 05, 2016 @03:56AM (#11040353)
I've whitelisted all the JavaScript on the site and now an additional annoying box with "keep in touch" is floating over the centre of the page, and if I scroll the page underneath up and down so that the box doesn't cover it I can see "content not available". Is this your first site?
Re:Learn Enough Git to Be Dangerous by sotojuan on Thursday February 04, 2016 @05:41PM (#11037872)
This looks great. Looking forwards to the Ruby one as well. I also saw Elixir in the "Coming Soon" section. What are your opinions on the language?
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @05:47PM (#11037899)
I don't know Elixir yet, but I'm collaborating with someone who does. I think the plan is he teaches me, then I teach you. :-)

I've heard great things about Elixir, and its design is heavily influenced by Ruby, so I think it will be a natural fit for Learn Enough to Be Dangerous.

Re:Learn Enough Git to Be Dangerous by thirdsun on Friday February 05, 2016 @04:21AM (#11040424)
Additionally a fully featured Phoenix Tutorial would be very welcome as well - however that's probably a silly thing to suggest if you have to learn Elixir first.
Re:Learn Enough Git to Be Dangerous by kiddz on Thursday February 04, 2016 @03:56PM (#11037150)
Why didn't you do a corresponding screencast?
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @03:59PM (#11037176)
Oh, that's definitely planned. :-) Even better, my Learn Enough to Be Dangerous cofounders and I are working on a subscription service that will integrate text and videos for the command line, text editor, and Git tutorials, with many more to come (including the upcoming 4th edition of the Ruby on Rails Tutorial). See http://learnenough.com/ to get some idea of what we've got in store.
Re:Learn Enough Git to Be Dangerous by frozenport on Thursday February 04, 2016 @04:02PM (#11037198)
git push --force?
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @04:15PM (#11037281)
The `git push --force` command didn't quite make the cut, but if you can think of a place where it fits into the current tutorial I'm certainly open to adding it. Maybe it fits in as an exercise somewhere?

UPDATE: yebyen has suggested this was a meant as a joke. If so—good one!

UPDATE 2: I don't mean to imply that force-pushing isn't useful! As several commenters below have noted, it most certainly is. But it's also most certainly dangerous.

Re:Learn Enough Git to Be Dangerous by mmanfrin on Thursday February 04, 2016 @04:42PM (#11037482)
I've seen `git push -f` used quite a bit over my career. Maybe it's bad practice, but it's useful for:

1. Organizations that want single-commit branches (e.g., where there's a lot of cherry picking going on in a git-flow style to get certain features pushed out) but you also want to keep 'savepoint' commits while developing. Squashing a bunch of commits requires a -f if you've already pushed.

2. Rebasing a branch (without making a bubble merge).

3. For truly small quick fixes you notice when you've just pushed to CI (like you left in a debug or a focus on some tests).

Re:Learn Enough Git to Be Dangerous by sjrd on Thursday February 04, 2016 @04:48PM (#11037538)
Much more than that. `git push -f` and `git rebase -i` are essential tools to keep a history where every commit passes CI. And that is very important for `git bisect`ing things later.

They are also necessary to keep a history where `git blame` can be used effectively.

Re:Learn Enough Git to Be Dangerous by brianwawok on Thursday February 04, 2016 @04:58PM (#11037620)
Rebasing shared branches is pretty nasty. Do people really keep a policy of "every branch must pass CI" ?

I like rebase on my branches so I merge as a single commit at the head of the branch I am merging into, but rebasing a shared branch is total ick.

As for needing every branch to pass CI forever to use git bisect.. that seems a bit extreme. I think I have used git bisect like 3 times in the past 5 years? And each time I wrote a very simple unit test and fed it into git bisect and was able to figure it out without a problem. If you are using git bisect constantly I guess I can see, but that has another smell. Who cares when it was broke, just fix the broke thing!!

Re:Learn Enough Git to Be Dangerous by mmanfrin on Thursday February 04, 2016 @05:00PM (#11037637)
On shared branches, I think the rules are different. Rebasing a shared branch is very sticky. But for single-dev branches, I think rebasing/forcing is fine -- do what you want until it enters the main stream.
Re:Learn Enough Git to Be Dangerous by brianwawok on Thursday February 04, 2016 @06:07PM (#11038005)
Sure but I think OP was advocating rebasing a shared branch so that git bisect would always pass on each commit
Re:Learn Enough Git to Be Dangerous by setpatchaddress on Thursday February 04, 2016 @11:36PM (#11039485)
git -f on a shared branch is a surefire way to lose commits. OMFG. It's better not to allow it at all. git revert will undo damage adequately, just not cleanly.
Re:Learn Enough Git to Be Dangerous by brianwawok on Friday February 05, 2016 @09:05AM (#11041427)
You usually won't lose commits with reflog, especially the more users of a repo the more reflogs.. but yes a disaster to go find them again...
Re:Learn Enough Git to Be Dangerous by peteretep on Thursday February 04, 2016 @10:12PM (#11039159)
As long as you can communicate the change to other branch users, I don't see the problem?
Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @05:28PM (#11037812)
Oh, for sure. I use it all the time. There's no doubt `git push -f` is useful. Even less doubt that it's dangerous. ;-)
Re:Learn Enough Git to Be Dangerous by yawaramin on Thursday February 04, 2016 @11:27PM (#11039438)
Re:Learn Enough Git to Be Dangerous by yebyen on Thursday February 04, 2016 @04:33PM (#11037430)
I think that was supposed to be a joke. Enough git to be dangerous... what about some dangerous git command which potentially destroys some important history... [stopgirl.gif]

Your books are great, I've been buying Learn Enough to be Dangerous preorders for topics I already know well because I learned so much from the Rails Tutorial dot-org. Thanks!

Re:Learn Enough Git to Be Dangerous by mhartl on Thursday February 04, 2016 @04:37PM (#11037453)
Heh, I almost replied that `git push --force` might be a little too dangerous! But the truth is it barely didn't make the cut, and I wouldn't mind finding a place to work it in.
Re:Learn Enough Git to Be Dangerous by dnate on Thursday February 04, 2016 @04:43PM (#11037491)
certainly one of the more dangerous git commands
Re:Learn Enough Git to Be Dangerous by brianwawok on Thursday February 04, 2016 @04:59PM (#11037624)
Many (most) people disable -force on key branches, if not they should!
Re:Learn Enough Git to Be Dangerous by juped on Thursday February 04, 2016 @11:56PM (#11039550)
Nothing in git is dangerous except push. This book advocates pushing quite often, making its title pretty accurate.

:)

Re:Learn Enough Git to Be Dangerous by hvis on Friday February 05, 2016 @12:43AM (#11039758)
git reset --hard
Re:Learn Enough Git to Be Dangerous by slavik81 on Friday February 05, 2016 @04:54AM (#11040510)
Generally recoverable by checking git reflog and doing another git reset --hard back to how it was before.

git clean -dfx is the most probable way for me to delete something that I never committed.

Re:Learn Enough Git to Be Dangerous by hvis on Saturday February 06, 2016 @06:42AM (#11047342)
You missed the point of the '--hard' argument. It destroys the local, uncommitted changes.

That can be much scarier than 'git push -f'.

Re:Learn Enough Git to Be Dangerous by slavik81 on Saturday February 06, 2016 @03:38PM (#11049719)
Apparently we both need to write better, because you missed the point of my example. Most—if not all—local changes that would be destroyed by git reset --hard show up in git status.

git clean -dfx will wipe out ignored files, which do not show up in git status, so it's much easier to forget about something you meant to keep.

Re:Learn Enough Git to Be Dangerous by hvis on Monday February 08, 2016 @06:31AM (#11057548)
I've never used 'git clean -dfx' routinely during development. On the other hand, I've seen a colleague lose a few hours' work by forgetting to commit a specific file out of a set, and then doing 'git reset --hard' for some reason. 'git status' didn't save him. Luckily, he did commit the corresponding tests file.
Re:Learn Enough Git to Be Dangerous by samstave on Thursday February 04, 2016 @04:44PM (#11037500)
This is wonderful thank you.
Re:Learn Enough Git to Be Dangerous by jeffwass on Thursday February 04, 2016 @07:21PM (#11038399)
Nice logo!
Re:Learn Enough Git to Be Dangerous by Anjin on Thursday February 04, 2016 @07:34PM (#11038472)
Thanks! There's also another variant that I created that we are using for our beta testing "Special Ops" team signup page: http://www.learnenough.com/special-ops
Re:Learn Enough Git to Be Dangerous by jeffwass on Friday February 05, 2016 @02:35AM (#11040116)
FYI, that page renders strangely on Safari on my iPhone. The text runs past the white rectangle background on the left half of the screen.
Re:Learn Enough Git to Be Dangerous by Anjin on Friday February 05, 2016 @02:59AM (#11040190)
Thanks. There were some quick changes that got pushed out as the post started gathering steam today.
Re:Learn Enough Git to Be Dangerous by randiLee on Friday February 05, 2016 @03:27AM (#11040273)
This is great, thanks.