Posts about "Git"

Finding the primary branch of a Git Repository

— 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.

Dry running Git commands

— 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.

Stashing individual files in Git

— 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.

Cherry picking commits in Git

— 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.

Using compact and tidy Git Log

— When it comes to using Git from the CLI, one of the commonly used commands is the git log command. The command essentially shows, as its name suggests, the log of all the commits (recent commit first).

Quickly switch between recent branches in Git

— 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.

The ideal Git workflow

— 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

— 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

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.