We have posted article for how to learn github commands without using any GUI. In this article we described about fully basic git commands and how to it use in terminal.

learn-git-basic-commands-in-5-minutes

 

 

1. Configure the author name and email address to be used with your commits.

git config --global user.name "Sam Smith" 
git config --global user.email [email protected]

2. Save github credentials in command

git config credential.helper store 
git pull

3. Create a new local repository

git init

4. Checkout repository

git clone /path/to/repository

5. List of branches

git branch -a

6. Create a new branch

git checkout -b <branchname>

7. Delete branch

git branch -d <branchname>

8. Checkout branch

git checkout <branchname>

9. Pull

//Fetch files from master
git pull --progress --no-rebase -v "origin"

// Pull from current branch
git pull --progress --no-rebase -v "origin" <branchname>

10. List of files you have changed
git status

11. Add files

// For a specific file 
git add <filename> 
// For all files 
git add *

12. Commit

//Commit new files 
git commit -m "<give some message about this commit"> 
//For example: git commit -a "Initial commit for user module" 
//Commit existing files 
git commit -am "<give some message about this commit">

13. Push

//Push current branch
git push --progress "origin" <branchname>

git push

14. Undo local changes

git checkout -- <filename>

15. Get modified files between master to local branch (File name only)

git diff --name-only master <branchname>

15. Show log

git log

These are useful commands which is used in Github for beginners.

 

Share Your Thoughts

0 Comments
Inline Feedbacks
View all comments
Subscribe Our Channel

Email Subscription
Watch Tutorials
Loading
Copyright © 2015 - 2021 PHPEXPERTISE.COM