Disclaimer: There are many subtleties to using git - this is a very basic workflow. Discuss in your team how you want to work!
This gist assumes that you have authorisation to clone/pull/push from your repo. Either it is public, or you have set up ssh authentication.
git clone <http or ssh link from git portal>
# change into the folder that is created as a result of the cloning.
cd <repo name>
Create a working branch for yourself
git checkout -b mybranch
-> this creates a branch as an exact copy of the branch you were on before. For now, this only exists locally on your machine.
Check this with:
git branch
-> this should put a star next to the branch you are in.
Note: Always make sure that you add/commit your own changes (see below) before you attempt to switch branches.
# make changes in your branch.
git add . # this stages any file (.) in the current directory
# ensure you are in the root of the repo when you do this!
git commit -m 'my commit message for the work I've just done'
# do this often
git push # the first time, git will tell you to configure the branch in the online version of the repo
# - just follow instructions: git push --set-upstream <branchname>
Use the pull request feature in the github UI once you've pushed to your own branch.
Note: it is best to first get your own working branch fully up to date with what has been happening on master in the meantime (see next). That way, you deal with any merge conflicts first, rather than the person who reviews your pull request later.
Do this only once you've committed changes to your working branch with the Standard workflow above - check that you're all clear:
git status
-> "nothing to commit, working tree clean"
Then, switch to the master branch
git checkout master # this switches to your local copy of the master branch (it won't yet know what has happened online)
git pull # you now have all the latest changes from others in your local copy
see "Dealing with merge conflicts" if you hit any.
Switch back to your working branch and merge master into it
git checkout dev/myname
git merge master -m 'my note about the fact that I'm updating my branch with master'
(optional) push your updated branch to the online repo
git push
or carry on making local changes with the standard workflow above.