Skip to content

Instantly share code, notes, and snippets.

View adivinho's full-sized avatar
🔨

Vadim Yalovets adivinho

🔨
View GitHub Profile
@adivinho
adivinho / revert-a-commit.md
Created September 30, 2019 21:02 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@adivinho
adivinho / genhash
Created March 4, 2019 13:12 — forked from ianmariano/genhash
generate a base-64 encoded sha-256 password hash with openssl on the command line
# generate an SHA-256 password hash base64 encoded
echo -n "password" | openssl dgst -sha256 -binary | openssl base64
# better yet, use pepper (suffix the password with the pepper)
echo -n "passwordpepper" | openssl dgst -sha256 -binary | openssl base64
# better yet, use salt (prefix the password with the salt)
echo -n "saltpassword" | openssl dgst -sha256 -binary | openssl base64
@adivinho
adivinho / delete_git_submodule.md
Last active March 20, 2019 17:11 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm -r --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
version: "3"
services:
pmm-server:
image: "perconalab/pmm-server:dev-latest"
ports:
- "443:443"
environment:
- SERVER_USER=pmm
- SERVER_PASSWORD=pmm
@adivinho
adivinho / gist:bb28bf605472d99a7028baf4e3a570dc
Created April 17, 2018 18:54 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@adivinho
adivinho / grafana_dashboards_backup.sh
Created February 20, 2018 08:54 — forked from devcfgc/grafana_dashboards_backup.sh
backup grafana dashboard templates
#!/usr/bin/env bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
KEY=<api_token_key>
HOST="http://localhost:3000"
if [ ! -d $SCRIPT_DIR/dashboards ] ; then
mkdir -p $SCRIPT_DIR/dashboards
fi