I'm trying to figure out how to use this command properly. I believe this is the command and flag I want to essentially make one branch into my other branch (basically delete a branch and create a new branch with the same name with the files of another branch), but I don't know for sure, or if I have the syntax correct.
If I do this:
git branch -f master sub-branch
Will it remove all of the files from master and fill it with the files from sub-branch?
A branch in Git is simply a lightweight movable pointer to one of these commits. The default branch name in Git is master . As you start making commits, you're given a master branch that points to the last commit you made.
git branch -r shows information on which branches your local tracking branches push to. git remote show origin shows that, plus more information: which branch is checked out on the server, the URLs your remote uses, and how your git configuration is set up to treat a push.
The -f
argument stands for --force
.
master
already exists, git will not allow you to overwrite it, unless you use -f
.sub-branch
) will be used to determine where the master
branch's HEAD
should be pointing to.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