I left unspecified because it defaults to HEAD, and we don't really care anyway. In summary: git checkout -orphan newbranch git/index git clean -fdx given in other answers). can be used instead (I believe this is equivalent to rm. Unfortunately, git reset -hard doesn't work, but git rm -rf. The only other action necessary is to remove any unwanted items from the working tree and index. This doesn't do exactly what the asker wanted, because it populates the index and the working tree from (since this is, after all, a checkout command). Git checkout now supports the -orphan option. There is a new feature (since V1.7.2) which makes this task a little more high-level than what's in any of the other answers. New branch that is entirely unrelated to everything that has happened Of procedure I would recommend to someone who is just getting started $ git update-ref refs/heads/other-branch $COMMITįinally, we returned to the master branch to continue work there. and created a new branch that points to our newly createdĬommit. ( git-commit-tree told us the sha1sum of the created commit object.) $ echo "Imported project foo" | git commit-tree $TREE Then, We committed the tree, without specifying parent commits. ( git-write-tree told us the sha1sum of the created tree object.) extracted directories and files from a tarball, added those to the We went to create a parentless commit to theĮxisting repository using git's plumbing: I remembered from reading John Wiegley's Git from the bottomīranches are essentially a label to a commit that follows a certainĬonvention and how a commit is tied to a tree of files and, optionally Merged into the master branch at a later time. Had been developed on the master branch, but they were going to be The contents of this branch really had a different origin from what While helping a friend with a git problem today, I had to introduce aīranch that needed to be totally separate from the master branch.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |