Git commands for beginners
Summary
With multiple people working on a software project, co-ordination sometimes becomes difficult. Git is a version control system (VCS) for tracing changes in computer files and coordinating work on these files. Given below are a few commands that can be commonly used while using this VCS.
Clone remote repo
1
git clone [repository-url]
Refresh repo for the latest from remote repo
1
git pull
List all branches
1
git branch -a
Switch branch
1
git checkout [branch-name]
Check the status of the current repository
1
git status
Add new files
1
git add filename
Browse past commit information
1
git log
Browse past commit information by using the one line option:
1
git log --online
Check-in changes
1
git commit -m "Message to commit this file or directory" [directory-or-filename]
Compare file with past revision
1
git diff cf39cd1 filename
Reset current branch head (HEAD) to the specified state
1
git reset <paths>