简体   繁体   中英

How do I make a branch at an old commit which I have already made changes to?

Here's what I'm doing. My master branch has a bug in it and I have identified an old commit using git bisect which is the latest commit which does not exhibit the bug.

I have had this commit checked out and made a few fixes to eliminate compiler warnings, so I'd like for these changes (unrelated to the original bug) to eventually get included.

What I want to do at this point is make a new branch here, which will have this old commit (the last non-bugged commit) as parent.

I suspect the answer is to just commit here, using -b branchname . Is that correct?

There is no commit -b . You should git checkout -b branchname , then git commit as usual. This will leave you with a new branch with one new commit on it, with the commit you previously checked out as its parent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM