Copy file from another branch
2025-12-02git checkout another-local-branch path/to/file.js
git checkout another-local-branch path/to/file.js
git checkout HEAD^ # back
git checkout HEAD@{1} # go to previous HEAD position
From HEAD (older commit) to main branch (up-to-date)
git log --reverse --ancestry-path HEAD^..main
bash script.sh iii
if [[ "$1" == "iii" ]]; then
echo "første parameter er iii"
else
echo "første parameter er ikke iii"
fi
lsprepush() {
if [[ -f ".git/hooks/pre-push" ]]; then
echo ".git/hooks/pre-push was found:"
echo "pre-push is activated"
else
if [[ -f ".git/hooks/pre-push.sample" ]]; then
echo ".git/hooks/pre-push was not found:"
echo "but .git/hooks/pre-push.sample was found:"
echo "pre-push is deactivated"
else
echo "Hmmmmm"
fi
fi
}