How to edit/commit/push to github 1) Make sure you are at master and your code is up-to-date > git branch or git status You will see: yslogin2:/glade/p/work/kayee/git_branch/WRF>git branch chem_github * master wrf-chem-photolysis-bug-fix yslogin2:/glade/p/work/kayee/git_branch/WRF>git status On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working directory clean 2) ***important*** git checkout -b new_branch_name ( it will create and cd to the new_branch_name) 3) git branch 4) edit your code (you should be in new_branch_name now) 5) Done editing. You can now commit, and write log file > git commit 6) After you commit, you can keep editing your code or you can puh it up to Github. We should check the origin and upstream (destination) before we push. > git remote -v yslogin2:/glade/p/work/kayee/git_branch/WRF>git remote -v origin https://kayeekayee@github.com/kayeekayee/WRF (fetch) origin https://kayeekayee@github.com/kayeekayee/WRF (push) upstream https://github.com/wrf-model/WRF.git (fetch) upstream https://github.com/wrf-model/WRF.git (push) If your upstream is NOT right, you can remove and add the correct one > git remote remove upstream > git remote add upstream https://github.com/wrf-model/WRF.git 7) After the confirmation of the upsteam link, you can push it now > git push -u origin new_branch_name 8) If you want to switch back to master > git checkout master 9) You can create as many as branches you want. For good practice, we should keep the master clean and only work/edit on the branches. 10) If you accidentially committed to the master and want to restore it back > git log find the commit ID that you want to restore commit 68fae7e9dff12b579f9b6ab6274f2d4d5cd2f184 Author: kayee Date: Tue Dec 20 18:01:46 2016 -0700 > git reset 68fae7e9dff12b579f9b6ab6274f2d4d5cd2f184 Here is some terminology: origin -> my modified code upstream -> destination