‹ jan0sch.de

Tags / Git

It is nice if your CI/CD pipeline does also check for code format compliance but sometimes you may want to have feedback earlier or even prevent unformatted code to enter the repository.

In such a case the git DVCS offers hooks to the rescue. You can either dive into their documentation or simply use the script provided below. ;-)

Sometime you need or want to move a commit or several of them between different git branches. One possible scenario would involve a created feature branch which runs a bit longer and multiple important fixes have been made on it. Some might argue that this shouldn’t happen but guess what: this happens all the time. ;-)

Gitea is a nice alternative for a self hosted Git service. However there is no official support for it in the TeamCity build and continuous integration server.

Because there are way to many options for git to remember it is feasible to have a template file for the .gitconfig which is usually located in the home directory.

If you ever need to change the author of a commit (or several) within a git repository, you can use the following script:

If you want to delete a remote git branch then you can do so using the following command.

A simple shell script that jumps into a given directory (or a default one) and updates all git repos in there. Additionally it checks if an upstream remote exists. If that is the case it fetches the upstream changes.

Like the cd - command git also has a shortcut to checkout the last branch. git checkout - switches to the last checked out branch.

If you want to mirror a svn repository via git there is a nice little gem called svn2git available that provides easy setup. Updating your repository is done via svn2git --rebase.

Sometimes you’ll want or have to split a git repository into two. This is usually a sign of not thinking forward enough but hey sh.. happens. If your repository is structured in a way that you just need a subdirectory of it into a new repository you can follow the steps below.

« ältere Beiträge neuere Beiträge »