Skip to content

Instantly share code, notes, and snippets.

View IamFaizanKhalid's full-sized avatar
🇵🇸
End Occupation. Free Filastin.

Faizan Khalid IamFaizanKhalid

🇵🇸
End Occupation. Free Filastin.
  • Mansehra, Pakistan
  • 11:38 (UTC +05:00)
View GitHub Profile
@IamFaizanKhalid
IamFaizanKhalid / git-commit-author.md
Last active December 5, 2024 18:13
Change author information of previous commits.

Interactive rebase off of a point earlier in the history than the commit you need to modify (git rebase -i <earliercommit>). In the list of commits being rebased, change the text from pick to edit next to the hash of the one you want to modify. Then when git prompts you to change the commit, use this:

git commit --amend --reset-author --no-edit

For example, if your commit history is A-B-C-D-E-F with F as HEAD, and you want to change the author of C and D, then you would...

  1. Update author's info git config --global user.email [email protected]
  2. Specify git rebase -i B (here is an example of what you will see after executing the git rebase -i B command)
@IamFaizanKhalid
IamFaizanKhalid / keep-git-log-opened.sh
Created March 3, 2021 07:59
If `git log` command output is cleared after pressing `q`, change its pager to use `less -F -X` command.
#!/usr/bin/env bash
git config --global --replace-all core.pager "less -F -X"

Error

Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

Solution

sudo usermod -a -G docker $USER
@IamFaizanKhalid
IamFaizanKhalid / clean-git-repository.sh
Created October 23, 2020 03:37
Delete all git branches except current branch.
git branch | grep -v '^*' | xargs git branch -D
@IamFaizanKhalid
IamFaizanKhalid / wallpaper
Last active April 2, 2020 13:01
Random Wallpaper from Unsplash
#!/usr/bin/env bash
usage() {
printf "Usage: $0 [-d] [ -p PATH | -t ] [ -o FILENAME ] [ -r RESOLUTION ]\n\n"
printf "\t-d to just download the image\n"
printf "\t-p to save image on specific path.\n"
printf "\t-p to save image in /tmp.\n"
printf "\t-o to save image with specific name.\n"
printf "\t-r to set custom resoltion for image.\n\n"
@IamFaizanKhalid
IamFaizanKhalid / script.scala
Last active February 17, 2020 11:21
File to be used during learning Scala..
#!/bin/bash
exec scala "$0" "$@"
!#
args.foreach(arg => print(arg+" "))
println("\n")
args.foreach(println)
println("\n")
@IamFaizanKhalid
IamFaizanKhalid / git-commands.md
Created February 12, 2020 12:39
Markdown file containing git related commands..

Git Commands

  • Initialize an empty repository
    $git init
  • Add files to staging area
    $git add filename.ext
  • Check changings status