This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Git Workflow
Federico Garcia-Lorca edited this page Feb 18, 2021
·
2 revisions
⚠️ IF YOU ARE NEW TO GIT AND GITHUB:we highly recommend that you read about Git Branches and read this entire page CAREFULLY and COMPLETELY
Navigate to your local repo and use the following command to pull the most recent version of the repo:
$ git pull
- We are treating branch "dev" as our main. You'll want to create a new branch for the issue you are contributing to.
- Use the following to create a new branch:
$ git checkout -b NameOfYourNewBranch
- Publish your new local branch to remote
$ git push origin NameOfYourNewBranch
- Edit, create, and delete as you see fit. Git will keep track of the changes as long as you are in the folder where you cloned the repo.
- You want to add the files you want to keep track of to the staging area of git. You do so with:
$ git add fileName
- It is good practice to make a new commit every time there is significant change to the file(s) you are tracking:
$ git commit -m "brief description of what you did"
- If this seems confusing, Codecademy has a Git Course or check the Git Handbook
- Once you are finished with all your changes and you have used commit to add them to the staging area, push them to remote:
$ git push origin NameOfYourNewBranch
- After your changes are pushed to GitHub, you can go to the repo page and create a pull request (PR for short) so that others can review your work and approve the changes.
- Once your commits are pushed to origin (the repo hosted on GitHub), you will see a new message on the site, something like "[branch name] has recent pushes" and a green button with "Compare & Pull Request". Click it.
- On the right side you should see a menu with an option to add reviewers. Invite others to review your work! (Vic-ST and probably aedwardg)
- Don't forget to add a meaningful commment to your PR. It should be brief and explain why your changes should be merged into the DEV branch.
- You can also use keywords to automatically link your PR to an open issue. Read all about it here.
- Congrats on your contribution! Reviewers might either approve the PR and merge it, or post comments with feedback.
Remember to check out the dev and master branches to ensure you have the most recent version of the code. You can get the latest version by using the following command:
$ git pull origin
- Typically, we want to use one branch per issue. That means that once your PR is merged into the
dev
branch, you should delete the branch (and create a new one if there is another issue you want to work on). - As you cannot delete the branch you are currently on, navigate to another branch. For example, the following command will switch your current branch to
dev
:
$ git checkout dev
- Delete the branch on remote with:
$ git push origin --delete NameOfTheBranch
- Now delete the branch locally (remember, you cloned the remote repo to your machine. That means they are effectively different):
$ git branch -d NameOfTheBranch