You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sajjad Rad edited this page Apr 25, 2014
·
3 revisions
You can find some useful git commands:
Start with Git
Add your information
run this command for add your full name:
git config --global user.name "YOUR_NAME"
and run this for add your email:
git config --global user.email YOUR_EMAIL
Initiate a git repo
cd to your project root directory and run:
git init
Clone a git repo
git clone [url]
Remote Git URL
Add remote git url to repo
cd to your project root directory and run:
git remote add origin [url]
Remove git url
cd to your project root directory and run:
git remote -v
Branches
Branch information
git status
Create a new branch
git checkout -b [branch name]
Switch to branch
git checkout [branch name]
Delete a branch
git branch -d [branch name]
Commits and files
Add all files to tracker
git add -A
Commit
git commit -m "Message"
Change branch without commit
sometimes you want to switch to another branch but your work is in progress and you don't want to commit changes.you can stash changes and switch to other branches and use stash again in future.