Git Cheat Sheet


The main operations in Git are clone, push and pull.
1. Clone a git repositor:
git clone git_url
e.g. git clone  git@github.com:Prinzhorn/skrollr.git

2. Push changes to git repo
Use git add filename or use git add . to add files that needs to be puhsed to the repo, where . is for all changed files. Use git commit -m 'message' to add message about the changes made. Finally push the changes to the repo.
e.g.
git add .
git commit -m 'design changes'
git push 

3. Pull changes from git repo
git pull
The above 3 operations are the basic git operations. You will perform daily. Some other operation you need are:
4. Create a new branch and switch to it
git checkout -b new_branch_name

 5. List all  branches (branch with * is the current branch)
git branch
6. Switch branch
 git checkout branchname
7. Rename a branch
git branch -m old_name_of_branch new_name_of_branch
8. List all remote upstreams
git remote -v 
9. Add new remote stream
git add remote_name git_url 
e.g. git remote add origin  git@github.com:Prinzhorn/skrollr.git

10.  To remove a remote stream
git remote rm remote_name








Comments

Popular posts from this blog

Automate file upload in Selenium IDE

How To Install and Configure Nextcloud