First, clone Repository
Clone repository on Github, as follows:
git clone git@github.com:fbing/design-patterns.git
Ii. Branch of Management
1. View Branches
1. View Local branches
Use the git Branch command, as follows:
$ git Branch
* Master
* Identifies the branch you are currently in. 2. View Remote Branch
The command is as follows:
Git branch-r
3. View all Branches
The command is as follows:
Git branch-a
2. Create a new branch locally
The command is as follows:
GIT branch [branch name]
For example:
Git branch Gh-dev
3. Switch to a new branch
The command is as follows:
git checkout [branch name]
For example:
Ricky@desktop-1qpastr mingw64/f/git_studio/design-patterns (Master)
$ Git Checkout gh-dev
switched to branch ' Gh-dev '
ricky@desktop-1qpastr mingw64/f/git_studio/design-patterns (Gh-dev)
4. Create + switch branches
To switch to the branch while creating the branch, the command is as follows:
git checkout-b [branch name]
The effect of git checkout-b [branch name] is equivalent to the following two steps:
GIT branch [branch name]
git checkout [branch name]
5. Push the new branch to GitHub
The command is as follows:
Git push origin [branch name]
For example:
Git push Origin Gh-dev
6. Delete local branch
The command is as follows:
git branch-d [branch name]
For example:
Git branch-d gh-dev
7. Delete GitHub Remote Branch
The command is as follows:
Git push origin: [branch name]
The colon before the branch name represents the deletion.
For example:
git push Origin:gh-dev