The 20200814-1320hrs part is the date and time in format YYYYMMDD-HHMMhrs, so that would be 13:20 hours (1:20 pm) on 14 Aug. In case I ever want to "undo" this, let's back up this branch first! I do this and find it super helpful and comforting to know I can always easily go back to this backup branch and re-branch off of it to try again in case I mess up feature_branch1 in the process: git branch feature_branch1_BAK_20200814-1320hrs_about_to_squash This is great for making backups before rebasing, squashing, hard resetting, etc.-before doing anything which could mess up your branch badly.Įxample: I'm on feature_branch1, and I'm about to squash 20 commits into 1 using git rebase -i master. To create a new branch from the branch you do have checked out: git branch new_branch What I call is what they call, and what I call is what they call : git branch Ģ. To create a new branch from a branch you do not have checked out:Ĭreate branch2 from branch1 while you have any branch whatsoever checked out (ex: let's say you have master checked out): git branch branch2 branch1 While I'm at it, I'll also add my other most-common git branch commands I use in my regular workflow, below. This isn't touched upon well, if at all, by any other answer here. I'm adding this because I really needed to know how to do #1 below just now (create a new branch from a branch I do not have checked out), and it wasn't obvious how to do it, and Google searches led to here as a top search result. This answer adds some additional insight, not already present in the existing answers, regarding just the title of the question itself ( Create a branch in Git from another branch), but does not address the more narrow specifics of the question which already have sufficient answers here. Various ways to create a branch in Git from another branch:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |