Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Saturday, 29 September 2018

I’ve searched a lot on Google how to do certain git actions, and this actually motivated me to write this post. This may not be so useful for a person who is a PRO in git, but I tried to list out all the git commands which will definitely benefit a newbie.





Here are the list of git commands which is going to get covered in this Post:


Clone
Stash Changes
List stashes
Apply stash
List branches
Create Branch
Commit
Push
Pull
Checkout Branch
Config
Ignore Filemode changes


Git Clone:
git clone [url]


Git clone with custom directory name:
git clone [url] [directory name]


Git Clone with password:
git clone https://username:password@xyz.com/abc/repository.git


Stash Changes:
git stash save
git stash save [stash name] 
This command stash changes with name

List all stashes:
git stash list


Apply a stash:
git stash pop
git stash apply


List branches:
git branch
Note:  The one which is highlighted is the current branch


Create Branch:
git branch [branch name]


Commit:
git commit -m “[ commit message]”


Push changes:
git push origin [branch name]


Pull changes:
git pull origin [branch name]


Checkout branch:
git fetch && git checkout [branch name]


Config:
git config –global user.name [name]
git config –global user.email [email address]


This command sets the author name and email address to be used with your commits.


Ignore File mode changes:
git config core.fileMode false

If you need or know some more essential git commands, mention it in comments. I am always open to learning. 

Useful Git Commands for developer

 
KayalSpot © 2015 - Designed by Templateism.com