Working With git – History Manipulation

Rick HerrmannOne of the most powerful features of git is that it gives you the ability to alter the commit history of your repository. This way I can have the best of both worlds by committing often during feature development, but then being able to consolidate all of the commits into a single “unit of work” when the feature is complete.  In the case where no new commits have been made to the master branch, the feature branch can be combined into a single commit with:


git checkout master

git merge feature-branch --squash

Continue reading “Working With git – History Manipulation”

The Value of GitHub

6Until recently we used Microsoft TFS for all of our source control. It worked well enough for small, simple projects where all that was necessary was basic check in/check out functionality.

As our business grew, we started running into limitations with TFS. We found that our clients for the larger projects would request new features that would take multiple months to complete, but still have smaller spot-changes for the project as those features were being worked on. In a standard source control system, branching allows you to work on a feature while the existing codebase is still available for modifications, but in TFS when those branches needed to be merged back together it usually ended up being a massive headache.

Continue reading “The Value of GitHub”

Working with Git – Cherry Picking Commits

Cherry-Picking

7The perfectly named git cherry-pick command is similar to git merge in that you can copy commits from a different branch into your current branch.  However, where merging will copy all of the commits from the other branch, cherry-pick is useful when you only want to copy specific commits into your branch.

Continue reading “Working with Git – Cherry Picking Commits”

Working with git – Ignoring Merge Conflicts for a File

7An issue I had to solve recently with git was how to ignore merge-conflicts for a single file in a repository.  The application is an AngularJS application, and as is common with a Single Page Application (SPA) there is a single index.html file that is the starting point of the app.  As part of the client-side build tooling, we are using two gulp plugins called wiredep and inject.  These two plugins automatically add the <script> references to the index.html file for all of the javascript files in your application – including both the referenced libraries (e.g. angular.js) and the application specific js files (controllers, services etc).  As a result, even though the developers almost never directly change the index.html file, it gets modified by the gulp tasks when the <script> references are added.  So with each commit, git considers the index.html file to have been modified.

Continue reading “Working with git – Ignoring Merge Conflicts for a File”