Create a branch from a Commit

 Git create new branch from master or current branch (mytrashcode.com)


Create a branch from a Commit

To create a branch from a commit, we can use simply pass the commit hash to the checkout command. This will ignore all the changes made above and after that commit.

So your new branch will only have changes until the commit you specify. It will ignore all the changes post that.

Here’s what the command looks like.

git checkout master
git pull
git checkout -b <New_branch_name> <commit_hash_id>

Creating a branch from a release tag

Similar to creating a branch from commit, you can also create a commit from one of the release tags.

Here is how the command looks like.

git checkout master
git pull
git checkout -b <New_branch_name> <tag_version>

Example:

git checkout -b new_branch v1.0.0

Không có nhận xét nào:

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...