This blog was created with the idea of collecting and linking information about Linux, Git, how to set things up, how to tweak the system here and there, in different architectures, in different distributions and different releases.
All the information presented here is available to public knowledge and can be found with one, two, or a few more Google searches if you persist. All of them were used at least once on productive activities.
Please share your experience and share your comments.
The Silversearcher tool is a super fast search tool that gives you rich information when searching for a string through all your files.
To install it:
sudo apt install silversearcher-ag
The Github project page:
You can find answers about why it is so fast, a chance to collaborate and other info there.
To get the repository’s tags issue:
$ git fetch --tags [branch_name]
To add a tag to the top commit:
$ git tag -a
Note: this will open an editor screen where you can insert a description message (similar to a commit)
To add a tag to a specific commit:
$ git tag -a [tag_name] [commit_hash]
To push a tag to remote:
$ git push [repo_name] --tags # for all tags
$ git push [repo_name] [tag_name] # for a single tag named 'tag_name'
To merge a tagged commit:
$ git merge [tag_name]
See also: how to see the information of the repo’s branches from the CLI, including your tags in this post
To rename a remote repository issue:
$ git remote rename origin https://github.com/OWNER/REPOSITORY.git
$ ssh-keygen -E md5 -lf ~/.ssh/id_rsa.pub
2048 MD5:c1:16:02:e0:22:72:c5:ef:93:c1:2d:7c:22:3c:55:43 dkreling@dkreling (RSA)
In case you need to work with more than one remote repositories, chances are you need to add one of them (origin comes as a default).
$ git remote add remote_name https://github.com/user/repo.git
Choose the remote_name as you wish and grab the repo URL from github.
You may also be interested in Selecting remote repository on git or maybe if you need to rename your remote, you might want to read how to rename a remote repository
For a little more information, visit: https://help.github.com/articles/adding-a-remote/
There are two main ways to show the history of a file using git (that is, listing all commits that changed a provided file).
The best one is:
$ git log --follow filename
It will list all commits that ever touched that file, including renames
$ git log -- path/to/file
…will also list all commits, but without resolving file renames.
You might also like git history log of a line, that lists all commits that ever touched a specific line