Useful Git Commands
This appendix describes the minimal set of git commands necessary to follow the CSLE contribution workflow (see the developer guide.).
When you start working on a new feature, first make sure that you have pulled the latest code changes by running the following commands in the root of the CSLE repository:
git checkout master
git pull origin master
If the above command did not succeed due to code conflicts you can either resolve the conflicts or choose to reset the code to the latest commit (this will override any local changes) by running the commands:
git reset --hard origin/master
git clean -fd
Next, create a new branch for your code changes by running the command:
git checkout -b mybranchname
Then you can make your code changes. When you have made a set of changes you can commit them by running the commands:
git add --all
git commit -m "comment for the commit"
You can make several commits. When you feel that your new feature is ready to be merged into m aster you can push the code to GitHub by running the command:
git push origin mybranchname
After pushing the changes you can go with your web browser to: https://github.com/Limmen/csle and open a new pull request.
When the pull request is merged into the master branch you can delete the local branch and pull the new changes from the master branch by running the commands:
git checkout master
git pull origin master
git branch -d mybranchname
After running the above commands you can verify that your commits are available in the master branch by running the command:
git log
- Previous
- Next