Manchester forking FRED merge batman
After tackling Responsive Web Design in Round 2, next on the agenda was Git and Github.
Unfortunately Jacob Clark @imjacobclark wasn't able to make it, but Tom Moitié @tmoitie did a smashing job inlcuding live coding a demo of how to do a git bisect.
My Talk
First up, as there were a few new faces I gave a brief introduction into Manchester FRED, the past events and the following events that are now confirmed.
Then I dove into Git and GitHub, explaining the difference between them and a bit about Linus Torvalds.
In the slides there's a link to a video by Linus and a somewhat interesting pull request that he received on GitHub that I'd recommend having a look at.
https://slides.com/s10wen/mcrfred-3/#/
Tom's Talk
Tom opened up by explaining some of the benefits of Git and some of the advantages over SVN.
Try GitHub
He then dove straight into some code using https://try.github.io/ which is a great way to get started with Git.
There seems to be this connotation that Terminal is a scary place to be. At first the blank box and $
can seem daunting, but it's well worth learning some basic commands.
GUIs
If you don't feel comfortable with this though, fear not, there's quite a few nice 'Git GUIs (Graphical User Interface)', in other words, an app or software that can help you out. https://git-scm.com/downloads/guis
I started off using http://gitboxapp.com/ it's super simple to get up and running and makes it really easy to quickly view over commit notes, search and diff files.
Branches
Next Tom talks about the benefits of branching. For example if you're working on a feature for a site, let's say we're adding a responsive slideshow, but then the client rings up and has spotted a bug on the live site. Branching allows you to easily create a branch, we can call this responsive-slideshow
we can then commit all the code we're working on to this branch, then switch back to our master branch that doesn't have the responsive-slideshow code in. Now we can go ahead and fix the bug, push the master branch live, then switch back to our responsive-slideshow
and carry on.
Conflicts
Next up is a conflicts demo, conflicts arise when Git doesn't know what to do with a particular bit of code. In this instance you'll generally get a conflict error showing the files in question. If you open each of the files, you'll find the following code:
1 | <<<<<<< HEAD |
Inbetween the code example above will be the code that's conflicting. You can then evaluate the code and edit as required, it might seem obvious, but yes, you'll also need to remove the Git conflict code that was added. After you have resolved all your conflicts, you'll be able to then add and commit.
Vim
Next, a quick introduction into Vim. If you're new to the command line and using Terminal, it can be a bit confusing if suddenly as you try to type your commands they don't trigger and instead it's as if you're in a document and wondering what's going on. This is more than likely because you have gone into Vim and editing a document. If this happens, you can hit Escape
then type :wq
to quit out of Vim.
Pull Requests
Pull requests can be immensely satisfying when accepted and just as valuable if they're not when a great explanation is given as to why.
More Advanced Techniques
Then some more advanced techniques were discussed including remotes, submodules, sub-tree merging, php - composer/packagist, ruby - ruby gems, rebase, git blame and git bisect.
Here's a video of the brave man doing a live demo :astonished:.
Hands On
After the talks we set about getting those up and running that weren't already and asking people to send over some pull requests to a page I'd added on the FRED site https://fredup.github.io/manchester/github-workshop.html.
I then :smirk: completely, deliberately and intentionally on purpose :smirk: demonstrated some of the things that can go wrong when merging and accepting pull requests if not everyone follows the same coding styles.
.@simonowendesign demonstrating beautifully why you need to have a carriage return at the end of every file. Amazing :D
— Tom Moitié (@tmoitie) May 30, 2013
https://editorconfig.org/ is something I use with Sublime Text 2 that helps with such issues.
Tom also showed me how he added a custom shortcut to Sublime Text 2 https://gist.github.com/tmoitie/5575062 and uses https://github.com/SublimeText/TrailingSpaces.
Since installing this myself I've been amazed how much trailing whitespace there is out there, but fortunately now it's really easy to spot and get rid of that :poop:.
Thanks again to the sponsors:
And everyone who came, hope you enjoyed it.
Browse by category:
- apple1
- bash1
- browser1
- case study4
- chrome2
- chrome dev tools4
- clojure overtone2
- conference2
- css2
- dev tips1
- digihike1
- dotfiles2
- event4
- ffconf1
- freelance6
- gaming2
- health3
- hexo1
- https1
- jank1
- javascript1
- jobs1
- lego1
- mcrfred107
- nux1
- octopress4
- photography2
- raspberry pi1
- responsive web design1
- sass1
- screencast1
- speaking2
- svg4
- unplugged6
- upfrontconf1
- web development2
- webgl1
- wordpress17
- work51
- workflow16