Scale your Git workflow with Git hooks – 2

In our previous post, we discussed what are git hooks, how to install git hooks ,few of the local git hooks and custom hooks. This post is continuation of the same and we are going to discuss more types of git hooks and their customization.

Post-Checkout git hook

The post-checkout hook works a lot like the post-commit hook, but it is called whenever you successfully check out a reference with git checkout.
Continue reading “Scale your Git workflow with Git hooks – 2”

Scale your Git workflow with Git Hooks

Git hooks are a very useful feature in the git. Git hooks are scripts that you can place in a hooks directory. They are triggered every time an specific event occurs in a Git repository. They let you customize Git’s internal behavior and trigger customizable actions at key points in your CI/CD and git workflow.

Some of the common use cases include to encourage a commit policy, altering the project environment depending on the state of the repository, to trigger continuous integration workflows before and after commits, etc. However since scripts can be written as per the requirements at hand, you can use Git hooks to automate or optimize virtually any aspect of your development workflow.
Continue reading “Scale your Git workflow with Git Hooks”

Working with remotes in Git, GitHub and Visual Studio

In previous post, we discussed about how to work with remotes in Git at command line. In this post, we are going to discuss how we can do the same from the very comforts of Visual Studio while we continue to host our source code on the GitHub. While it’s true that there is no command or built-in option available in Visual Studio to connect to GitHub, we can leverage one of the extensions available for GitHub.

Install GitHub Extension for Visual Studio

To search for this extension, let’s open Visual Studio first. From the tool bar menu, select Tools and then click on the ‘Extensions and Updates’:
Continue reading “Working with remotes in Git, GitHub and Visual Studio”

Save your changes temporarily in Git using Git Stash

This happens almost every now and then. You are in middle of working on some code changes, modified few files here and there and may be added new files. Now something else comes up urgently and you are asked to do it now. But you do not want to make a commit in middle of the work. In such a case, if you switch branch, your changes are carried over to the another branch as well. So you need a way to save your work temporarily. Fortunately, Git allows this functionality using what is known as Git Stash.

Stashing takes the dirty state of your working directory — that is, your modified tracked files and staged changes — and saves it on a stack of unfinished changes that you can reapply at any time.
Continue reading “Save your changes temporarily in Git using Git Stash”

Using Path filters in Build definition in Azure DevOps / VSTS

Sometimes it happens that for the organization and maintenance purpose, you would like to keep all code related to one component of a product in one place only. Now that component may be complex component having multiple sub parts like API, UI, Database etc. Again, for the purpose of easy maintenance, you would like it all under one repository, which is not an bad idea. Now, imagine if you have different builds configured for different sub-components which are using this source code as their base and are configured to trigger on some event, say commit. Then for each small and big commit, it will trigger build in each of the configured builds. Ideally, if the change was related to only one sub-component say API, then you would need to trigger only API specific build and not the ones for the UI and/or Database.  Continue reading “Using Path filters in Build definition in Azure DevOps / VSTS”