I can checkout a particular file from a branch into current branch with git checkout branchname filename. How can I checkout all the files in branchname into current branch?
git checkout branchname does not fit my need since that will switch me away from current branch.
git merge branchname does not fit my need since I do not want to create a commit yet.
Thanks!
git reset --hard branchname
Note that this will get rid of any changes you had in the current branch that aren't in the other branch, and any uncommitted changes you might have had laying around. It will keep you on your current branch but change it to point at the commit which branchname refers to.
If you instead want to not change what commit is being pointed at, you could instead just check out the whole tree:
cd `git rev-parse --show-toplevel`
git checkout branchname .
This is the equivalent of running git checkout branchname filename for the entire repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With