Git Cheat Sheet
The main operations in Git are clone, push and pull.
1. Clone a git repositor:
git clone git_urle.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 pullThe 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 branch6. Switch branch
git checkout branchname7. Rename a branch
git branch -m old_name_of_branch new_name_of_branch8. List all remote upstreams
git remote -v9. Add new remote stream
git add remote_name git_urle.g. git remote add origin git@github.com:Prinzhorn/skrollr.git
10. To remove a remote stream
git remote rm remote_name
Comments
Post a Comment