Gituhb
Github
Most popular version controlling tool
List existing branches.
git branch
Switch to a different branch
git checkout <branch_name>
Merge changes from one branch into the current branch
git merge <branch_name>
Temporarily save changes that are not ready to be committed.
git stash
Fetch remote change like if new branch created etc
git fetch -all
View commit history
git log
git reset --hard <commit>: Move the current branch pointer and reset the staging area to a specific commit
Push local changes to a remote repository
git push
Clone a remote repository to your local machine
git clone
how to git reset to specifici comitt and push to to gituhb remote repo
git reset --hard <commit-hash> git push -f origin <branch-name>
Main Branches
develop and master are main branches
When the source code in the develop branch reaches a stable point and is ready to be released, all of the changes should be merged back into master somehow and then tagged with a release number. How this is done in detail will be discussed further on.
Therefore, each time when changes are merged back into master, this is a new production release by definition.
Supporting branches
Next to the main branches master and develop, our development model uses a variety of supporting branches to aid parallel development between team members, ease tracking of features, prepare for production releases and to assist in quickly fixing live production problems. Unlike the main branches, these branches always have a limited life time, since they will be removed eventually.
The different types of branches we may use are:
- Feature branches
- Release branches
- Hotfix branches
Each of these branches have a specific purpose and are bound to strict rules as to which branches may be their originating branch and which branches must be their merge targets. We will walk through them in a minute.
When starting work on a new feature, branch off from the develop branch.
$ git checkout -b myfeature develop Switched to a new branch "myfeature"
Feature branches
May branch off from: develop
Must merge back into:develop
Branch naming convention:anything except master, develop, release-*, or hotfix-*