Thursday, 10 December 2015

Bitbucket

19:02:00 Posted by Kumanan
Command Lines:-

To check out your branch:
  git fetch && git checkout master

To check the status:-
  git status

To add a file to do commit:-
  git add <file_name>

Undo git add before commit:-
  git reset <file_name>

To commit a file:-
  git commit

To commit a file with a message:-
  git commit -m "<your message>"

To get Branch name:-
  git branch

Create the branch on your local machine and switch in this branch :
  git checkout -b <branch_name>

Switch to other branch in local:-
  git checkout <branch_name>

Create branch in remote:-
  git push <remote_name> <branch_name>

  Note:- The remote branch is automatically created when you push it to the remote server. So when you feel ready for it, you can just do the above.

To get log list:-
  git log
  git shortlog

Total committed count:-
  git shortlog -s

To revert the previous commit:-
  git reset --hard <commit_id>

To get the changes from the remote:-
  git pull

To Clone a branch other than master branch :-
  git clone <remote_name> -b <branch_name>

Difference between 2 branch :-
  git diff <branch_1> <branch_2>

To get the files which has changes between branches :-
  git diff --name-status <branch_1> <branch_2>


To get Git username :-
  git config user.name
  git config --list

To change Git username:-
  git config --global user.name "Alvin J. Alexander"
  git config --global user.email "alexander123@hotmail.com"

To Clone a Specific Git Branch :-
  git clone --single-branch --branch <branchname> <remote-repo>

To view all the branch available :-
  git branch -a