git init
git fetch
git branch
git checkout -b new_branch_name
git checkout branch_name
git add .
orgit add file_name
git commit
git push
- run
git init
to create a
- Fetch the latest from the current repository by running
git fetch
- If you want to clean up old branch that have been merged and deleted
git fetch --prune
- Look at what branch you are on with
git branch
command - Checkout a new branch based on the one you are on
git checkout -b new_branch_name
.-b
flags stands for branch
- To checkout out a already existing branch you run the command
git checkout branch_name
, that will automatically set up-stream for a branch if the branch exist on orgin
- First you have to stage all files for commit but running either
git add .
for all fiels orgit add file_name
- Run
git status
to see all the staged changes - When everything looks good, you can run the command
git commit
git push --set-upstream branch_name