Adding tags to git repository

This is just a quick memo to remember how to add tags to repositories.

For exiting commit:

  • List all commits: git log --pretty=oneline
  • Pick the one you wish to tag (first seven letters of the has are enough), i.e.: 32c274c
  • Add a tag: git tag -a 0.1.0 32c274c -m "First version before general refactor"

For latest commit: git tag -a 1.4.5 -m "My version 1.4.5".

Tags are always added to local repository and never pushed to remote by default. You have to explicitly tell git to do so. For example, by executing git push --tags.

More info in Git Basics – Tagging and Managing releases in a repository.

Read More “Adding tags to git repository”

Setting git user globally or for given repository

This is just a quick note to future self about operations on git user and emails address.

1. Read current setting for given repository:

cd template-repository
git config user.name
git config user.email

2. Read global settings (affects all new repositories on given PC):

git config --global user.name
git config --global user.email

3. Change current setting for given repository:

cd template-repository
git config user.name "johnny.bravo"
git config user.email "johnny.bravo@cartoonnetwork.com"

4. Change global settings (affects all new repositories on given PC):

git config --global user.name "johnny.bravo"
git config --global user.email "johnny.bravo@cartoonnetwork.com"

You may also want to read about setting your commit email address, setting your username in Git or blocking command line pushes that expose your personal email address in GitHub Help guide.

If you wish to check or change your GitHub user in PhpStorm then Ctrl+Alt+SGitHubEnter.

Reviewing your current email settings in GitHub can also sound like a good idea.

Quick changes in repository name

This is just a quick memo to future self on what should be done locally, if I rename some GitHub repo:

git pull
git push
git prune
git remote prune origin
git status

Or even faster:

git pull && git push && git prune && git remote prune origin && git status

I am changing a lot of my repos’ names to figure out some static scheme. This is a “toolset” for that process.

How to check GitHub user’s registration date…

…and other basic account information for any GitHub user?

There are at least two ways of getting this information:

  • the “clickable” way and
  • public API call

The documentation for API call tells about required token, when calling it from cURL or JavaScript.

But my tests has proven that simply pasting this URL to browsers’ address bar doesn’t require any token and works even if you are not logged in to any GitHub account.

Read More “How to check GitHub user’s registration date…”

MEGA — file sharing and cloud storage far above average

The IT world grows, big data becomes your everyday’s pal. Whether you are a developer or project manager, you need to store more and more data each and every day. Getting a good quality and reliable solution becomes a bit challenge. To help you with that I wanted to tell you a bit about MEGA service.

I found it by a complete coincidence (I am not getting paid for this post!) — a friend has shared a file with me. I dug into details and found it interesting. In my opinion MEGA is far better than most file sharing services and can challenge even well known cloud storage options like Google Drive, Dropbox or OneDrive.

So, what makes MEGA that unique? In short: command-line tool, NAS support, mobile apps, browser’s extensions and many more.

Read More “MEGA — file sharing and cloud storage far above average”

keepachangelog.com of your stuff?

I am not intend to tell you that you should keep a change log of any piece of software that you ever develop. This is as obvious as the fact that sun shines and fire burns. If you don’t understand this or disagree then you’re certainly at the wrong address.

However, with this article I am going to tell you about a specific way of keeping history of changes to your software. The one that keepachangelog.com suggests. The one that I immediately fell in love with.

Read More “keepachangelog.com of your stuff?”

The “Couldn’t agree a key algorithm” error in Git for Windows

When trying to perform any authentication-related operation in Git for Windows you may hit the wall with:

Couldn’t agree a key algorithm (available: list of available methods)

Some people says (here and here for example, but also in many other places) that this is due to your PuTTY not being up-to-date and ordering getting latest version of PuTTY as a cure. You’re lucky, if that works for you! :>

I wasn’t that lucky and it turned out that in case of my Git for Windows TortisePlink was actually the problem.

Read More “The “Couldn’t agree a key algorithm” error in Git for Windows”

Git workflow for modern projects

After four years of a break for doing some management stuff and other non-development tasks I have decided to get back into coding (or at least to start thinking about getting back to it). First thing was to prepare development environment in general and refresh git flow knowledge in particular.

This article is a mixture of both my old article about Git+Gerrit workflows and Git workflow for Yii 2 contributors article. I assumed minimalist approach to make it possible to use this new workflow for virtually any Git-based project. Thus, I have purged most of, if not all of the things that are specific to Gerrit and Yii2.

Before continuing with this article, make sure that:

In addition, you may want to change the Git Bash’s prompt to something, you are more familiar with.

Read More “Git workflow for modern projects”

Show closed Jira tickets as last

For some of my JIRA filters (and for JIRA lists on some of my Confluence pages) I need to display all closed JIRA tickets as last and all in progress in the beginning of list. Using ORDER BY status failed because Closed isn’t neither first nor last status name when ordering status names alphabetically.

Searching Internet also didn’t help, but I managed to find a cool workaround:

ORDER BY resolution DESC

It assumes that any JIRA ticket in progress has resolution set to Unresolved which in JIRA means “empty value” and causes all tickets with such resolution to be displayed first and all tickets with Resolution != Unresolved to be displayed as last.

Images in GitHub’s wikis

GitHub is the best place (known to me) for doing a not-too-much-demanding management or collaboration of not-too-big projects. It offers you (of course!) repository hosting, powered by simple, yet effective bug and issues management and wiki pages for help or guides for your project. And the only problem, that beginners usually face, is hosting images for that wikis. GitHub allows you to upload images to issues in issue tracker and does all the dirty work of hosting them for you. But, a bummer appears, when it comes to images in wikis, because Add image button in any wiki page editor allows you to enter URL only and there is no way to simply upload them to your wiki.

Read More “Images in GitHub’s wikis”

Private repository with public issues on GitHub

On contrary to BitBucket, GitHub does not allow you to have private repository with public issues. But, you can setup a two different repositories — private for code hosting and public for issues (read more in GitHub Help). And, what is most important and what not everyone knows — GitHub’s commit message’s grammar parsing is powerful enough to handle crossed commits.

Read More “Private repository with public issues on GitHub”

Move repository from GitHub to Gogs or any other remote

This is basically a check-list on pushing entire local repository, with all branches, tags and entire history to brand new remote repository and changing default remote setting in local repostiory from one to another. A compilation of this and this answers on Stack Overflow plus some own thoughts. Gogs and GitHub are quite similar to each other and all operations an made on command-line, so you can use this article as an aid in migrating one remote repository to another.

Read More “Move repository from GitHub to Gogs or any other remote”

Installing Gogs on Windows [discontinued]

This article is unfinished and discontinued! It contains a lot of useful information, but will not lead you to the very end. The only reason, for which I wanted to install and use Gogs was the fact, that my programming model (Yii2-based) required me to have a really large number of private repositories (each for every component, that my applications are using). And storing them on GitHub was very expensive.

However, as of May 11, 2016 GitHub has announced an unlimited number of private repositories available for every paid plan. This rendered Gogs completely useless for me. But, in the same time, it was also a very relief for me, because even though a whole long year passed since I started writing this article, I have never actually even touched problem of reconfiguring Composer to use source other than GitHub (Gogs).

Feel free to use this article to learn more about Gogs and its installation on Windows, but keep in mind, that this artice is unfinished and pretty much likely will never be finished.

Read More “Installing Gogs on Windows [discontinued]”

Git diagram for data transport commands

If you’re unfamiliar with data transport commands in Git or have troubles understanding the idea of four “buckets” (workspace, index, local repository and remote repository) or you’re generally a newbie to Git, then there’s a great answer at Stack Overflow, which basically is a diagram image taken from Oliver Steele’s blog and that actually explains everything! :>

Read More “Git diagram for data transport commands”

Setting up new project in Gerrit

Because Gerrit is evil and wrong (see here for details), even such simple task,like creating a new project, requires a separate document and todo list.

Also, keep in mind, that you can’t delete a project through web GUI of Gerrit. This is most wanted and requested feature of this dully project management tool, but still hasn’t been implemented for years.

So, create your new project wisely, because you won’t be able to delete them, without playing around console, installing some third-party plugins or doing stupidities similar to this.

Read More “Setting up new project in Gerrit”

Completely remove file from local and remote (GitHub) repository

This is the short version of “Remove sensitive data” article in GitHub Help. And an alternative solution to the one presented [here](Remove file from repository and from all revisions.txt). It assumes, that you are the only collaborator to repository, so you can perform steps at once (you don’t have to contact others and wait until they rebase your changes) and that your repository doesn’t use tags, so you don’t have to perform all steps.

If any these two assumptions is not correct in your case, then avoid this article and rather follow to mentioned article. Keep in mind, however, that in some certain situations, you have to contact GitHub Support in order to finish entire procedure.

Read More “Completely remove file from local and remote (GitHub) repository”

Undo last Git commit using git undo-commit command

There are probably thousands of websites telling you, how to undo the last Git commit. For example, one of the most voted up questions on Stack Overflow. But none of them (or actually nearly none of them) answers, how to do this using git undo-commit. Simply because, such command does not exist! :> Therefore, the title of this text should rather sound “Defining own Git alias to undo last Git commit“, since this article is focused on git aliases rather than on undoing last commit in Git.

Read More “Undo last Git commit using git undo-commit command”

Differences between SSH key generated by ssh-keygen and Puttygen

There are some key differences between SSH keys generated by ssh-keygen and Puttygen so you may run into problems importing or adding keys generated by the latter one, while importing ssh-keygen‘s keys goes swimmingly.

Here are some tips on this problem. Of course, we’re talking about public SSH keys, as private one are secret and shouldn’t be added or imported anywhere.

Read More “Differences between SSH key generated by ssh-keygen and Puttygen”

Remove file from repository and from all revisions [updated]

Say, that you have commited to a Git repository, a file, that contains sensitive or confidential information. You want to literally purge it from the repository history.

Simple git rm --cached <file> won’t do the trick. It will remove a file from the repository (keeping it in your working directory), but it will still keep the file in history. What now?

Read More “Remove file from repository and from all revisions [updated]”