Last active
April 17, 2021 15:49
-
-
Save iscott/757aeedc7ec3e34b510904c67f0542a2 to your computer and use it in GitHub Desktop.
Revisions
-
Ira Herman revised this gist
Apr 17, 2021 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,9 @@ ### Create a branch called "my_feature_branch" and change your git to working on that branch: ``` git checkout -b my_feature_branch ``` The branch is an exact clone of what master was when you ran the command. -
Ira Herman created this gist
Apr 17, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ # Basic workflow for git branching: ### Create a branch called "my_feature_branch" and change your git to working on that branch: ```git checkout -b my_feature_branch``` The branch is an exact clone of what master was when you ran the command. Work as usual, however all edits will live in that feature branch only -- they won't affect master. ### If you want to throw out the changes, just git checkout master. * And you'll be back on the main branch with no changes * To get back to your feature branch: `git checkout my_feature_branch` ### If you want to merge your changes into the master branch: On the `my_feature_branch` branch: ``` git add -A git commit -m "message goes here" ``` then to merge in the changes from the jamie branch: ``` git checkout master to switch back to the master branch git merge my_feature_branch ``` You've successfully merged in your feature branch changes. At this point you can leave your feature branch in the git repo, or delete it to merge the history back into master. ### Deleting the feature branch (after changes are merged into master): ``` git branch -d my_feature_branch ```