Is it possible to commit a file in a git branch with out checking out that branch? If so how?
Essentially I want to be able to save a file in my github pages branch
This is how I do it:
if I've acidentally committed, roll back one commit:
git reset --soft 'HEAD^'
add the files you want to add
git add .
create a new temporary branch:
git checkout -b oops-temp
commit your changes:
git commit -m "message about this commit"
checkout the branch you meant to check out:
git checkout realbranch
merge the old branch:
git merge oops-temp
delete the old branch:
git branch -D oops-temp