Last active
April 2, 2023 04:55
-
-
Save Marlena/926431 to your computer and use it in GitHub Desktop.
Marlena's github cheats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Workflow: | |
From forked & updated repo: | |
create branch | |
Either: | |
-git branch litmus_11759_test_blank_search (create branch) | |
-git checkout litmus_11759_test_blank_search (switch to that branch) | |
or: | |
-git checkout -b litmus_11759_test_blank_search (create & switch to branch) | |
do work in branch | |
-if added files, add them to git | |
git add <filename> | |
-commit in branch | |
git add <changed files> | |
git commit -m 'message' | |
(do not use "git commit -a -m 'litmus 11759: added test for blank search' " as it will make AutomatedTester cry.) | |
push forked branch | |
- (if never pushed before) | |
git remote add myfork git@github.com:Marlena/Addon-Tests.git | |
- (every push) | |
git push origin litmus_11759_test_blank_search | |
Click "pull request" on original github repo | |
To move head back to master: git checkout master | |
Once work on branch is finished, clean up. | |
Sync back up with automatedtester's master: | |
git remote add automatedtester git://github.com/AutomatedTester/Addon-Tests.git | |
git fetch automatedtester | |
git merge automatedtester/master | |
To change filename: | |
git mv old_filename.py new_filename.py | |
(commit the file) | |
Undoing stuff: | |
1. If a file has been added but not committed: | |
git reset <filename> | |
2. If you did git add -a, git commit and didn't want to commit the file BUT you don't want to discard changes: | |
git reset HEAD <file with changes you to uncommit but don't want to discard changes> | |
3. If you've made changes but haven't committed and ur new code sucks so you want to roll back to the last commit: | |
git checkout -- <filename> | |
4. If you want to get rid of a commit and go back in history, | |
a. look up the commit with: git log --pretty=format:"%h - %an, %ar : %s" | |
b. reset the head to that commit: git reset --hard a6b4c974 | |
If you delete lots of files and git status shows you all of them: | |
git add -u | |
This stages the files to be removed from the repository index. | |
They will disappear after the next git add/git commit | |
Before you hit that big green button: https://wiki.mozilla.org/Web_Testing/Automation/CodeReviewProcess#How_to_do_a_merge.3F | |
If libraries in requirements.txt get updated, will need to: | |
pip install -r requirements/mozwebqa.txt | |
or will get import errors for missing libraries. |
Me too! <3
Thanks Marlena! I found this useful.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
after all this time I'm still using this Gist :D