What’s get? Oh…GIT. I don’t git it. Who’s on first?
As you will find, Git is no joke. Version control is paramount when professionally writing code, and Git is the go-to version control system for Ruby on Rails. The Git basics can be grasped quickly, but should not be taken for granted. Git also offers a much deeper and broader set of functionality that is extremely powerful, and can have a steep learning curve. This stack is dedicated to all things Git. Git commands, concepts, processes, Github, Git tools, resources, best practices, tutorials, etc.

Git squash and merge two commits into one

08/13/15  Public, Git

$ git rebase --abort
$ git rebase --interactive HEAD~2

If you want to squash all of the commits back to origin/master run: $ git rebase -i master


1 vote - harrylevine

Bring down a new Git branch from origin repo to your local repo

08/08/15  Public, Git

If there is a new branch out on the origin repo (in GitHub), and you do no have a copy of that branch in your local remote repo, here is what you will run to bring that copy down to your local remote repo:

1 vote - harrylevine

Create a link from GitHub that brings you directly to a specifically highlighted set of lines in a file

06/24/15  Public, Git

  1. Navigate to the file in the GitHub repo
  2. Click on the line numbers you want to highlight (use the shift key to highlight multiple lines)
  3. Copy the link from the address bar

1 vote - harrylevine

Git reset one file

04/08/15  Public, Git

$ git checkout HEAD -- my-file.txt

For example:

$ git checkout HEAD --

1 vote - harrylevine

Very common recurring workflow with Git

11/15/14  Public, Workflows, Git

$ git branch --> Should be on your master branch
$ git checkout -b welcome-controller --> This creates a new branch called welcome-controller. Replace "welcome-controller" with name of your new branch
$ git branch --> *Should be o...

3 votes - harrylevine