Saturday, August 1, 2015

Basic Git Commands

What is Git
Git is a revision control system. It keeps track of changes.

1. show all branch
This git command list down all your local git branch and also highlight the branch name you are currently in.

2. create new branch
This git command create a new branch named 'newBranchName'.

3. switch to another branch
This git command switch to 'newBranchName' branch.

4. create a new branch and switch to it
5. delete a branch

6. rename the current branch

7. rename the branch which is not your current branch

8. status
This git command list the files you have changed and those you still need to add or commit.

9. add single file
add one file to staging

10. add all files
add all files to staging

11. commit changes to head (but not yet to the remote repository)
12. send changes to the branch of your remote repository
13. update from the remote repository
fetch and merge changes from the remote server(master branch) to your working branch

14. get list of commit id

15. show difference (changes) between two commit id

16. show difference (changes) between two branch

17. changes local working directory code to specific commit

18. show GUI

19. undo git add for single file

20. undo git add for all files

21. undo git commit

22. view your remote branches