Useful Git Commands listed with its uses briefly


Here is some useful commands to manage your development using git


git init (Initialize your git project directory)
git status (Check current status)
git add filename (Add a single file created or modified)
git add . (Add all new file created or modified)
git add *.html (Only add html files that is newly created or modified)
git commit -m “first commit” (Commit to repository after add with a comment)
git push origin master (Push all files to origin master)
git log (Check log)
touch gitignore (Create a .gitingore file, enter a file name will be ignored while adding/updating)
git branch MyBranch (Create Own Branch)
git checkout MyBranch (Select a branch for work/change)
git merge MyBranch (Merge my new branch with master branch)
git merge master (merge master with branches)
git stash (save the new file created yet for future commit)
git stash apply (Commit the stash file/files)
git remote (view remote repositories)
git clone repository-url (Checkout the remote git project)
git remote -v (See original source url)
git fetch origin (Will download but not merge)
git pull origin ( will download and merge altogether)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s