Skip to content

Instantly share code, notes, and snippets.

View iodic's full-sized avatar

Marko Ranđelović iodic

View GitHub Profile
@iodic
iodic / copy-lines-between-files.sh
Created March 30, 2022 13:32
Copy a range of lines to a different file
sed -n '80950,80955p' source.log > destination.log
@iodic
iodic / push-changes-up-to-commit.sh
Last active November 22, 2019 18:41
How to push changes to a remote up to a certain commit
git push origin <commit_SHA>:master
@iodic
iodic / pull-all-remote-branches.sh
Created April 5, 2018 07:25
Pull all remote branches from the remote repository
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
@iodic
iodic / exclude-directory-from-git-diff.sh
Created March 28, 2018 09:41
Exclude a directory from git diff
git diff -- . ':!directory_name'
@iodic
iodic / list-changes-between-branches.sh
Created March 28, 2018 09:17
Show a list of commit differences between git branches
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative master..develop
@iodic
iodic / git-stash-apply.sh
Created March 28, 2018 08:28
Apply stashed changes
git stash apply
@iodic
iodic / git-stash.sh
Created March 28, 2018 08:19
Git stash
git stash
@iodic
iodic / selective-git-stash.sh
Created November 24, 2017 13:52
Stash files & chunks interactively using Git
git stash -p
@iodic
iodic / find-oldest-file.sh
Created October 16, 2017 08:26
Look for the oldest file in a Unix directory
find -type f -printf '%T+ %p\n' | sort | head -n 1
@iodic
iodic / search-git-history.sh
Created May 31, 2017 09:44
Search Git history for a string in PHP files
git log -Srelevant_string -- *.php