![]() ![]() The current commit is determined by the position of this branch. In attached mode HEAD is tied to the branch it references. This "thing" can either be a local branch ( HEAD is in attached mode) or a specific commit ( HEAD is in detached mode). HEAD is a special reference in Git that always points to "the thing" you have currently checked out. If you need to get your code into the branch from which you created this new branch from, you will need to do a merge, but this is another discussion altogether. For this new branch, 7y8u33ii will be HEAD, so you will be able to commit new changes. where 7y8u33ii is the hash you provided in the question. Git checkout -b my_new_fancy_branch 7y8u33ii If you need to make changes to the code or need to build it using Jenkins MultiBranch Pipelines, for example, it is also possible to create a new branch from that specific commit by running: Most of the time, detached HEAD (checking out an older commit) is used if you want to test how your project ran at a certain point in time. In this situation, if you make changes and try to commit them, you will be unable to do so, since you are not at HEAD, and GIT will not allow you to commit your changes. However, as you figured out, it is possible to check out a specific commit hash, if you want to. HEAD is a "pointer" to the latest commit in that branch, and GIT will allow you to commit new changes after that pointer. The "normal" way of working with GIT is by checking out branches. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |