Skip to content

git commands

Josh Greig edited this page Mar 12, 2018 · 12 revisions

If you are doing any of these processes with git, you may need to use the vim text editor and may also be interested in commands described at Basic-VIM-commands.

Say you are pushing up and get a permissions issue:

If you forked the main repository, you may not have write permission on the original repository.

To get around this, push to your fork instead. Substitute your github username into 'your_username' and run the following: git remote set-url origin https://github.com/your_username/hhaccessibility.github.io.git

Say your fork's master branch is behind the main repository's master

Run something like this:

  1. git remote add upstream https://github.com/hhaccessibility/hhaccessibility.github.io.git # Let "upstream" represent the main project repository.
  2. git checkout master
  3. git pull upstream master # Download latest from the main repository instead of your fork.
  4. git push origin master -f # Update your fork's master branch to include latest from the main repository.
  5. git checkout issue-244 # Start rebasing your branch on latest.
  6. git rebase -i master
  7. git push origin issue-244 -f

Say you are working on a new issue:

  1. git branch issue-63 // assuming 63(sign up page) is the issue you’re working on
  2. git checkout issue-63
  3. Implement and test the changes you want.
  4. git add file1.txt
  5. git add file2.txt //////////// any files you updated
  6. git commit –m “app: changed files… describe this better”
  7. git push origin issue-63 –f //////////// to get the branch on github

Say you want to get some changes that were merged recently on github.

  1. Commit changes to your non-master branch like issue-63 if there are any.
  2. git checkout master
  3. git pull upstream master

Say you want to get latest changes on a branch you’re working on:

  1. Same steps as above to get latest on your master branch.
  2. git checkout issue-63 (whatever branch you’re working on)
  3. git rebase issue-63
  4. Either it says “Successfully rebased…” after 10 seconds or so and your done or you’ll run into a rebase conflict which is handled by the next steps.
  5. git status (shows you what files need manual review for rebasing)
  6. Update the files. The ones needing review should have lines like >>>>>>> and <<<<< marking lines needing your attention.
  7. When you’re satisfied with the changes, run “git add file1.txt” assuming that’s a file you manually updated. Add all the files you updated.
  8. git rebase --continue
  9. You might have to do steps 6 and 7 more than once but eventually you should get to the “Successfully rebased…” message from step 4.

Referencing an issue or pull request

To reference an issue or pull request on github, add a #{issue or pull request number} to your git commit message. For example, #216 will point to issue 216(User Profile: State/Province/Territory "region" Data Table).

Clone this wiki locally