|
|
### :warning: This content is outdated
|
|
|
|
|
|
Projects in the WEB group use a loose git workflow.
|
|
|
|
|
|
Staging, Develop and Master Branches
|
|
|
|
|
|
Instead of a single *master* branch, this workflow uses **two** branches to record the history of the project and one extra branch to test out features and changes on our staging environment. The *master* branch stores the official release history, the *develop* branch serves as an integration branch for features, finally the *staging* branch has to be considered a dirty branch that can be overwritten and used for testing new features.
|
|
|
|
|
|
On projects with translation enabled, there is also a translations branch that has configuration changes that allow the page to have more languages. This branch is used to preview translations before enabling them on the website.
|
|
|
|
|
|
## How to send a merge request or propose a change
|
|
|
|
|
|
1. Make a clone of the tor git repository. All the repositories in the WEB group have a single source of truth: [https://gitweb.torproject.org/project/web/](https://gitweb.torproject.org/project/web/).
|
|
|
It is recommended that you clone from tor git even if you want to create a repository under your user space in gitlab.
|
|
|
|
|
|
2. Create a new branch for the changes you want to make and start editing the pertinent files. When you save the changes, Gitlab will suggest you to create a merge request. If you mention the related ticket URLs on the commit message, your commit will appear related to it. You can also share the merge request link with the others developers to have the change merged, or make a comment mentioning it on the corresponding issue.
|
|
|
|
|
|
3. Make sure there is a ticket about the work you are doing. The ticketing system helps us organize our work and help each other.
|
|
|
|
|
|
If you are not used to work with git, you can edit our websites content via gitlab directly.
|
|
|
Here is a doc on how to use gitlab without getting involved with git: [Use gitlab to edit websites](./Use-gitlab-to-edit-websites)
|
|
|
|
|
|
## How to use our git flow
|
|
|
|
|
|
Consider a fast-forward git approach:
|
|
|
|
|
|
```
|
|
|
# Start a new feature
|
|
|
git checkout -b new-feature master
|
|
|
# Edit some files
|
|
|
git add <file>
|
|
|
git commit -m "Please add a meaningful comment
|
|
|
about your changes"
|
|
|
# Edit some files
|
|
|
git add <file>
|
|
|
git commit -m "Try to explain why you make this
|
|
|
changes, not only the changes
|
|
|
(as they can be easily seen with a git diff)"
|
|
|
```
|
|
|
Adding the URL of the ticket you are trying to fix will create a relationship with the merge request.
|
|
|
|
|
|
You can also use ['will-fix: TicketURL' or 'closes: TicketURL'](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) so the ticket is closed when pushed. Please add the complete URL for the ticket, to prevent closing tickets on other projects.
|
|
|
|
|
|
You work on your local branch your new feature. You send a merge request to the main repository.
|
|
|
|
|
|
If your merge is accepted and you have push right to the project repository:
|
|
|
|
|
|
### Merge in the new-feature branch
|
|
|
```
|
|
|
git checkout master
|
|
|
git merge new-feature
|
|
|
```
|
|
|
### Remove your local branch
|
|
|
```
|
|
|
git branch -d new-feature
|
|
|
```
|
|
|
|
|
|
## How to merge from a branch or third party repository.
|
|
|
|
|
|
When you are merging from a branch or third party repository make sure to edit the commit message in a way that other contributors now what you are doing.
|
|
|
|
|
|
If you want to be nicer you could also simply merge commits from the branch so that you keep the commit messages of the initial contributor. [See doc about cherry-picking](https://git-scm.com/docs/git-cherry-pick)
|
|
|
|
|
|
If when you push there are new commits in the remote repository, it's better to refresh your local repository with:
|
|
|
```
|
|
|
git pull --rebase origin master
|
|
|
```
|
|
|
|
|
|
To update this wiki you can submit a merge request for the repository:
|
|
|
- `git@gitlab.torproject.org:tpo/web/wiki.wiki.git`
|
|
|
- `https://gitlab.torproject.org/tpo/web/wiki.wiki.git` |
|
|
\ No newline at end of file |