-
Notifications
You must be signed in to change notification settings - Fork 5
This is a page on basic usage of git.
git clone <repo url>
Note: You should probably delete the master branch, so as not to overwrite it or push changes to it.
git clone git@github.com:annsonn/saboteur.git
git branch -a
git checkout <branch name>
Switching to the remote master branch: git checkout origin/master
Switching to a local branch: git checkout feature/someFeature
Create the branch. You must currently be in the branch you want to clone from. This works with remote branches as well.
git checkout -b <branch name>
The -b
tells git to create a new branch.
Note: Prefix the branch name with feature/
or fix/
to group it to fixes or features. For organization sake.
git checkout -b fix/someFix
When your base branch has changes, you'll want those changes.
git fetch <remote name>
Where <remote name>
is the name of your remote repository, typically origin
.
git rebase
Rebase will roll back to when you first created the branch, update your base, then replay your changes. If there is a conflict, edit the conflicted files to resolve them. Add the files using git add, then continue your rebase with git rebase --continue
. You'll then want to force push your branch to remote.
You may need to add new files that are not included into your local repository. Omit if no new files.
git add -A
Save your changes with a change message.
git commit -am '<message here>'
This will save all your committed changes to a remote repository (effectively saving your changes on a server).
git push -u <remote name> <branch name>
Where is the name of the remote repo, typically origin
. The -u
tells git to default pull requests to the remote branch.
You've created a branch you weren't supposed to. So delete it.
git branch -d <branch name>
Github allows you to delete a remote branch after merging a pull request. But you may want to delete it manually.
git push <remote name> :<branch name>
Make sure you include the :
to signal a delete.
git remote prune <remote name>
Remember that is typically origin