-
git branch
list your branches. a * will appear next to the currently active branch
-
git branch [branch-name]
create a new branch at the current commit
-
git branch -a
Shows remote and local branches
-
git branch
Shows only local branches
-
git branch -d [branch_name]
Deleting a local feature branch, forcefully using -D
-
git push -d [remote_name][branch]
Deleting a remote branch
-
-
git checkout [branch_name]
switch to another branch and check it out into your working directory
-
git checkout -- <path_to_file>
Discarding changes made on a file
-
git checkout -b [branch_name]
Creating and checking in with a single line
-
-
git merge [branch]
merge the specified branch’s history into the current one
-
git log
show all commits in the current branch’s history
-
git worktree
Manage multiple working trees attached to the same repository.
git worktree add [path_directory][branch_name]
create path_directory and checkout branch_name into it
git worktree list
list details of each worktree