Git commands for beginners

Categories Tech TipsPosted on
Git commands for beginners

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:

git clone [repository-url]

Refresh repo for the latest from remote repo:

git pull

List all branches:

git branch -a

Switch branch:

git checkout [branch-name]

Check the status of the current repository:

git status

Add new files:

git add filename

Browse past commit information:

git log

Browse past commit information by using the one line option:

git log --online

Check-in changes:

git commit -m "Message to commit this file or directory" [directory-or-filename]

Compare file with past revision:

git diff cf39cd1 filename

Reset current branch head (HEAD) to the specified state:

git reset <paths>

Thanks for stopping by guys! I'm Vijayan and Techpulse is my beloved brainchild. Currently working as a PHP developer in a digital marketing start-up, I'm overly passionate about not just learning new things but also putting those into practice. I swear by a quote I once came across... 'What separates successful people from unsuccessful people is the former's ability to execute'. Feel free to reach out to me if you have any questions, suggestions or feedback. Hoping to see more of you here!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: