Tag: git

Benefits of Monorepo

#build #monorepo Why Mono-repo Using a monorepo where HEAD always points to a consistent and valid version removes the problem of tracking multiple repo versions entirely Static analysis can run across project boundaries without any extra work. Many other things, like cross-project integration testing and code search are also greatly simplified. You just refactor the API and all of its…

The Best Git Commands for Dev

The most common part is: The basic cycle git pull master to get up to date git checkout -b myname-feature to get a branch of your own git add <files> that you changed/created git add . to add everything in the current directory git add -u to add all existing files in the repo git commit git commit -m “multiline…

git pull, merge and rebase

It is always better to rebase local commits while pulling remote published changes. git merge will create a merge entry in the history, rebase is preferred because it orders your local commit on top of the latest remote commits. To avoid typing –rebase whenever you pull you can config git to use it as default: git config –global pull.rebase true…

7 Rules of Git Commit Log

The seven commonly accepted rules on how to write a git commit message are: Limit the subject line to 50 characters. Capitalize only the first letter in the subject line. Don’t put a period at the end of the subject line. Put a blank line between the subject line and the body. Wrap the body at 72 characters. Use the…

How to Pick a Commit of Git Submodule?

Current State There is a new submodule ‘test’ and we want to add it to the repo. Steps Git add submodule $ cd my_repo $ git submodule add git@github.com:vishalkanaujia/dev-tools.git Initialize the repo $ git submodule update –init –recursive cd to the submodule $ cd dev-tools By default, the latest version is picked. We can checkout to a commit for moving…

How to use Gist with Stackedit for WordPress blog?

How to use Gist with Stackedit for WordPress blog? Create the gist and copy the git number An example is https://gist.github.com/vishalkanaujia/c7d692de9a3b337e9ad8e655533b9856 The gist id is the last string of the address: “c7d692de9a3b337e9ad8e655533b9856” In the stackedit source (markdown file), add the following code: [g i s t]c7d692de9a3b337e9ad8e655533b9856[/g i s t] Please type as “gist” WordPress will automatically interpret the command and…

Git Cheat Sheet

Describe a change number $ git show dc54076 Reset the current branch with HEAD of master $ git fetch origin $ git reset –hard origin/master Keep your branch in sync with origina master branch $ git pull origin master Arrange all changes in order. Fixes the log too. $ git rebase origin wip_my_work Squash commits in one commit. 2 represents…

git push error “remote: Invalid username or password. fatal: Authentication failed”

I have 2-factor authentication enabled on my account. The repo is my own and I was unable to push changes to a private branch. Steps to resolve 1. Check your remote of repo $ git remote -v origin https://github.com/vishalkanaujia/gnome-connection-manager-1.git (fetch) origin https://github.com/vishalkanaujia/gnome-connection-manager-1.git (push) Looked carefully, I was trying to push using https. 2. I updated local system’s SSH keys to my…