In git workflow, the ideal strategy to work is to fork a new branch, make changes and finally merge in the main development branches. Over the time, this results in creation of large number of branches which are not required and becomes stale. Although a branch is just a pointer to an commit and does not require more than 40 bytes of disk space, it can be painful to search a long list of branches and deciding what you want to work on. Also since we humans are not good with creating unique names for branches, they can also result in confusion.
Below are some steps to clean branches from git repository to remove the clutter.
Delete a Local branch
Continue reading “Delete Branches in Git using commands”
Git Cherry-pick is used by many Organizations as an alternative to the rebase and merge. Cherry-pick is used to copy selective commits from one branch to another branch. Unlike a merge or rebase, cherry-pick only brings the changes from the commits you select, instead of all the changes in a branch. You can also choose whether to apply only one commit from another branch or a number of commits from another branch.
Why Git Cherry-pick
Cherry-pick is a great way to tackle below common problems:
- Accidentally committing on the wrong branch. In this case, one can use git Cherry-pick to apply the change(s) over to the correct branch and then reset the original branch to the previous commit. Continue reading “Understanding Git Cherry-pick and how it is useful”
Garbage collection is a well known software practice. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program. When we talk about the Git Garbage Collection, we mean almost the same thing. Git garbage collector runs a number of housekeeping tasks within the current repository, such as compressing file revisions (to reduce disk space and increase performance), removing unreachable objects which may have been created from prior invocations of git add, packing refs, pruning reflog or stale working trees.
Continue reading “Understanding Git Garbage Collection”
This blog post is part of in-depth blog series on the working with Git command line and Git in Visual Studio. You can find the previous blog post here. In previous blog post, we discussed how to use git rebase commands, the effects of same on the branching strategy and also rebasing on the same branch. In this post, we’ll discuss how to use git rebase inside Visual Studio.
Re-creating Problem Scenario
For starters, we have two branches named master and newQuickFix branch in Continue reading “Working with Git and Visual Studio – Use Git Rebase inside Visual Studio”
This blog post is part of in-depth blog series on the working with Git command line and Git in Visual Studio. You can find the previous blog post here. In previous blog post, we discussed what is git rebase, how it is different from git merge and when to use the rebase command. In this blog post, we’ll follow that up by using git rebase commands at git command line and understand it further.
Re-creating Problem Scenario
For starters, we have two branches named master and newQuickFix branch in our
Continue reading “Working with Git and Visual Studio – Use git rebase with git command line”
This blog post is part of in-depth blog series on the Git and Visual Studio. You can find the previous blog post here. In this blog post, we’ll understand what is git rebase, how it is different from git merge and when to use the rebase command. The git rebase command is one of those commands which can work magic for managing the future development of a product by simplifying git history but it can be disastrous if not used carefully. Essentially, git merge and git rebase do the same thing, i.e., bring the contents of two branches together. However both of these commands execute this change, in entirely different ways. Continue reading “Understanding Git Rebase and when to use it”
In git, branch is just a pointer to the one of the commits. So you can create and remove branches very easily. Most of the time, you can select commit of your choice and create a new branch from their and delete the one you do not need. However, sometime you create one branch out of master, intending to merge it to master but later everyone starts using the same and it becomes kind of master. We ran into this situation with one of the source code repository. So to get back on track, we needed to swap the contents of the both branches. Continue reading “Swap master branch with another branch in Git”