Make "git diff" look beautiful in the terminal
September 13, 2024 — If you’re working with Git often in the terminal, you might have noticed that the git diff
command is not very pretty when displaying unstaged changes.
Using Human-friendly dates in Git
August 17, 2024 — Git is a de-facto standard for version control these days. And there’s no doubt that it’s a powerful tool that can help you manage your code and collaborate with others.
Finding the primary branch of a Git Repository
October 20, 2023 — If you’re using Git, you might have noticed that the primary/default branch of a Git repository is called master
. But, since the word master
has a negative connotation, many organizations have started to use different names for the default branch.
Git Uncommit
August 29, 2023 — Here’s a handy little Git alias that you can use to undo your last commit. Thanks to Freek sharing this on X.
The fastest way to switch between two branches in Git
August 11, 2023 — This is something you might already be aware of but if you’re using Git on your terminal, there’s a faster way to switch between two branches using the checkout command.
Dry running Git commands
February 27, 2023 — There are some things that you can do in Git that you might want to test out before actually running them. For instance, you might want to check what will be added to the Git index before running the git add
command.
Attaching additional notes to a Git commit
January 1, 2023 — When you commit a change in Git, you can add a message along with it. This message is essentially a note that you can add to the commit.
Stashing individual files in Git
December 29, 2022 — Stashing is a very useful feature in Git. It allows you to temporarily save your changes in a stash and then apply them later. This is very useful when you want to switch to another branch but don’t want to commit your changes yet. You can stash your changes and then apply them later.
How to checkout Git branches interactively
June 5, 2022 — Working with Git, the one thing that you would do more often is to checkout branches. The way to checkout to a branch is by using the git checkout
command.
How to use Git Log command efficiently
June 1, 2022 — If you’re a modern developer and using Git as your choice of the version control system, you would have used the git log
command at some point of time in your career.
Cherry picking commits in Git
January 27, 2022 — I have been using Git since the start of my career (Which spans 10 years now). I have heard about this Git’s feature called cherry-pick
every now and then but I haven’t been in a situation where I would actually use it. Until today.
Trigger CI/CD deployments using empty Git Commits
January 20, 2022 — One of the most common scenarios with modern software development is the use of CI/CD pipelines. The way these CI/CD pipelines work is, you set up a webhook on your Git repository and allow these deployments to run every time something is pushed to the repository.
Quickly switch to new branch with unstaged changes in Git
January 9, 2022 — Consider the scenario where you’re working on a Git branch called featureB
and you have a lot of unstaged files in this branch.
Fetch commit logs of certain function or method in Git
January 3, 2022 — You would reach for the git log command when you want to take a look at the list of commits for the Git repository you’re currently in.
Clone repositories without the entire history in Git
December 16, 2021 — There comes a time when you want to clone a Git repository through GitHub or a similar client but at the same time, you don’t want the entire history of that repository.
Remove local branches which don't have remote counterparts in Git
October 31, 2021 — Working with Git, it might be the case when you’re working on your feature branch, you worked on it and then pushed it onto the remote.
Using compact and tidy Git Log
Quickly search keywords in your projects using Git Grep
August 2, 2021 — More often than not you’ll find yourself in situations where you would need to search keywords or phrases across your project.
Quickly switch between recent branches in Git
May 15, 2021 — When working on projects, it’s often a case when you would find yourself dabbling between different branches. Maybe you’re working on different features simultaneously or you’re keeping your feature branch up-to-date with your master/main branch. You would need to switch between branches in any of the cases.
Smartly auto-correct commands in Git
January 25, 2021 — How many times did it happen to you that you mistyped a Git command and curse yourself every time you do it? I did. Many times. It’s annoying!
Push to newly created branch without creating an upstream branch in Git
July 19, 2020 — Git is a lot easier when you make the best out of it. For instance, setting a simple Git config can make your life a lot simpler and smoother.
The ideal Git workflow
October 24, 2018 — Today, I’m going to discuss about Git workflow that we’re using at our projects which involves a team of several developers. Git is no doubt a great version control system but if you don’t use it efficiently, things can get messy easily. For instance, if there are 10 people working on the same codebase and each of them work on the same branch, it would be really difficult to keep the branch’s state clean. So, here’s a workflow which we follow in all our projects. The workflow is could work great for big teams but small teams can also get benefited from it equally.
Store it like git stash
October 6, 2018 — If you have ever worked with Git, you probably have encountered the following situation. i.e. You’ve two branches, let’s say feature-1
and feature-2
, for two different features respectively. You have worked on the the first branch feature-1
, completed all the related tasks and committed and pushed all the outstanding changes on that branch. So, the feature-1
branch is now clean.
Using private repositories as a composer package in PHP
September 5, 2018 — Composer is the goto method of adding dependencies in modern PHP application. You search for a library for a concerned functionality and you’ll probably find the one in the large database of the Pacakgist. But there comes a time where you’d want to use a library which is private and should be only available to you. Well, the good news is, you can achieve this using this trick.