Git Javascript AJAX jQuery HTML PHP Example MORE

Git Branch Git checkout


Git Branch

git branch command to show the list of branch and your selected branch(different color)

git branch

Create new branch

git branch <branch name>

git checkout <branch name>

git push -u origin <branch name>
or
--set-upstream (help us to set the upstream)

git checkout -b <new branch name> <existing branch name>

git add .

git commit -m"messaage"

Now merge your changes to development without a fast-forward

git checkout development

git merge --no-ff myFeature (newly created branch)

git push

git push -u origin myFeature

Git checkout

  1. We can move to particular branch and pull the latest code from that branch
  2. We can move to particular commit and pull the latest code from that commit
  3. We can unmodifies a modified file. It is a dangerous command. Any local changes we made to that file will remove.