| 1 | ## Contributing to Git Large File Storage |
| 2 | |
| 3 | Hi there! We're thrilled that you'd like to contribute to this project. Your |
| 4 | help is essential for making it the best it can be. |
| 5 | |
| 6 | Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE.md). |
| 7 | |
| 8 | This project adheres to the [Open Code of Conduct](./CODE-OF-CONDUCT.md). By participating, you are expected to uphold this code. |
| 9 | |
| 10 | ## Feature Requests |
| 11 | |
| 12 | Feature requests are welcome, but will have a much better chance of being |
| 13 | accepted if they meet the first principles for the project. Git LFS is intended |
| 14 | for end users, not Git experts. It should fit into the standard workflow as |
| 15 | much as possible, and require little client configuration. |
| 16 | |
| 17 | * Large objects are pushed to Git LFS servers during git push. |
| 18 | * Large objects are downloaded during git checkout. |
| 19 | * Git LFS servers are linked to Git remotes by default. Git hosts can support |
| 20 | users without requiring them to set up anything extra. Users can access |
| 21 | different Git LFS servers like they can with different Git remotes. |
| 22 | * Upload and download requests should use the same form of authentication built |
| 23 | into Git: SSH through public keys, and HTTPS through Git credential helpers. |
| 24 | * Git LFS servers use a JSON API designed around progressive enhancement. |
| 25 | Servers can simply host off cloud storage, or implement more efficient methods |
| 26 | of transferring data. |
| 27 | |
| 28 | Since the focus for the project is on end users, we're generally hesitant about |
| 29 | introducing new features that make data loss easy or are prone to misuse. |
| 30 | However, we're not necessarily opposed to adding generally applicable |
| 31 | customizability or features for advanced users if they don't conflict with other |
| 32 | project goals. |
| 33 | |
| 34 | ## Project Management |
| 35 | |
| 36 | The Git LFS project is managed completely through this open source project. The |
| 37 | [milestones][] show the high level items that are prioritized for future work. |
| 38 | Suggestions for major features should be submitted as a pull request that adds a |
| 39 | markdown file to `docs/proposals` discussing the feature. This gives the |
| 40 | community time to discuss it before a lot of code has been written. |
| 41 | |
| 42 | [milestones]: https://github.com/git-lfs/git-lfs/milestones |
| 43 | |
| 44 | The Git LFS teams mark issues and pull requests with the following labels: |
| 45 | |
| 46 | * `bug` - An issue describing a bug. |
| 47 | * `enhancement` - An issue for a possible new feature. |
| 48 | * `review` - A pull request ready to be reviewed. |
| 49 | * `release` - A checklist issue showing items marked for an upcoming release. |
| 50 | |
| 51 | ## Branching strategy |
| 52 | |
| 53 | In general, contributors should develop on branches based off of `main` and pull requests should be to `main`. |
| 54 | |
| 55 | ## Submitting a pull request |
| 56 | |
| 57 | 1. [Fork][] and clone the repository |
| 58 | 1. Configure and install the dependencies: `make` |
| 59 | 1. Make sure the tests pass on your machine: `make test` |
| 60 | 1. Create a new branch based on `main`: `git checkout -b <my-branch-name> main` |
| 61 | 1. Make your change, add tests, and make sure the tests still pass |
| 62 | 1. Push to your fork and [submit a pull request][pr] from your branch to `main` |
| 63 | 1. Pat yourself on the back and wait for your pull request to be reviewed |
| 64 | |
| 65 | Here are a few things you can do that will increase the likelihood of your pull request being accepted: |
| 66 | |
| 67 | * Follow the [style guide][style] where possible. |
| 68 | * Write tests. |
| 69 | * Update documentation as necessary. Commands have [man pages](./docs/man). |
| 70 | * Keep your change as focused as possible. If there are multiple changes you |
| 71 | would like to make that are not dependent upon each other, consider submitting |
| 72 | them as separate pull requests. |
| 73 | * Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). |
| 74 | * Explain the rationale for your change in the pull request. You can often use |
| 75 | part of a good commit message as a starting point. |
| 76 | |
| 77 | ## Discussions |
| 78 | |
| 79 | [Our discussions](https://github.com/git-lfs/git-lfs/discussions) are the |
| 80 | perfect place to ask a question if you're not sure on something, provide |
| 81 | feedback that isn't a bug report or feature request, or learn about use cases or |
| 82 | best practices with Git LFS. There's even a search box to help you see if |
| 83 | someone has already answered your question! |
| 84 | |
| 85 | You can also check [the FAQ](https://github.com/git-lfs/git-lfs/blob/main/docs/man/git-lfs-faq.adoc) |
| 86 | to see if your question is well known and already has an easy answer. |
| 87 | |
| 88 | ## Issues |
| 89 | |
| 90 | If you think you've found a bug or have an issue, we'd love to hear about it! |
| 91 | Here are some tips for getting your question answered as quickly as possible: |
| 92 | |
| 93 | * It's helpful if your issue includes the output of `git lfs env`, plus any |
| 94 | relevant information about platform or configuration (e.g., container or CI |
| 95 | usage, Cygwin, WSL, or non-Basic authentication). |
| 96 | * Take a look at the |
| 97 | [troubleshooting](https://github.com/git-lfs/git-lfs/wiki/Troubleshooting) and |
| 98 | [FAQ](https://github.com/git-lfs/git-lfs/wiki/FAQ) pages on the wiki. We |
| 99 | update them from time to time with information on how to track down problems. |
| 100 | If it seems relevant, include any information you've learned by following |
| 101 | those steps. |
| 102 | * If you're having problems with GitHub's server-side LFS support, it's best to |
| 103 | reach out to [GitHub's support team](https://github.com/contact) to get help. |
| 104 | We aren't able to address GitHub-specific issues in this project, but the |
| 105 | GitHub support team will do their best to help you out. |
| 106 | * If you see an old issue that's closed as fixed, but you're still experiencing |
| 107 | the problem on your system, please open a new issue. The problem you're seeing |
| 108 | is likely different, at least in the way it works internally, and we can help |
| 109 | best when we have a new issue with all the information. |
| 110 | |
| 111 | ## Building |
| 112 | |
| 113 | ### Prerequisites |
| 114 | |
| 115 | Git LFS depends on having a working Go development environment. We officially |
| 116 | support the latest version of Go, although we try not to break backwards |
| 117 | compatibility with older versions if it's possible to avoid doing so. |
| 118 | |
| 119 | On RHEL etc. e.g. Red Hat Enterprise Linux Server release 7.2 (Maipo), you will need the minimum packages installed to build Git LFS: |
| 120 | |
| 121 | ```ShellSession |
| 122 | $ sudo yum install gcc |
| 123 | $ sudo yum install perl-Digest-SHA |
| 124 | ``` |
| 125 | |
| 126 | In order to run the RPM build `rpm/build_rpms.bsh` you will also need to: |
| 127 | |
| 128 | ```ShellSession |
| 129 | $ sudo yum install ruby-devel |
| 130 | ``` |
| 131 | |
| 132 | (note on an AWS instance you may first need to `sudo yum-config-manager --enable rhui-REGION-rhel-server-optional`) |
| 133 | |
| 134 | ### Building Git LFS |
| 135 | |
| 136 | The easiest way to download Git LFS for making changes is `git clone`: |
| 137 | |
| 138 | ```ShellSession |
| 139 | $ git clone [email protected]:git-lfs/git-lfs.git |
| 140 | $ cd git-lfs |
| 141 | ``` |
| 142 | |
| 143 | From here, run `make` to build Git LFS in the `./bin` directory. Before |
| 144 | submitting changes, be sure to run the Go tests and the shell integration |
| 145 | tests: |
| 146 | |
| 147 | ```ShellSession |
| 148 | $ make test # runs just the Go tests |
| 149 | $ cd t && make test # runs the shell tests in ./test |
| 150 | $ script/cibuild # runs everything, with verbose debug output |
| 151 | ``` |
| 152 | |
| 153 | ## Updating 3rd party packages |
| 154 | |
| 155 | 1. Update `go.mod` and `go.sum`. You can ensure the latter is up-to-date by |
| 156 | using Go tools instead of manually editing `go.mod` (e.g., `go get |
| 157 | gopath@version`) or by running `go mod tidy` or `make go.sum`. |
| 158 | 1. Commit the change. |
| 159 | 1. Submit a pull request. |
| 160 | |
| 161 | ## Releasing |
| 162 | |
| 163 | If you are the current maintainer, see |
| 164 | [the release howto](./docs/howto/release-git-lfs.md) for how to perform a release. |
| 165 | |
| 166 | ## Resources |
| 167 | |
| 168 | - [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/) |
| 169 | - [Using Pull Requests](https://help.github.com/articles/using-pull-requests/) |
| 170 | - [GitHub Help](https://help.github.com) |
| 171 | |
| 172 | [fork]: https://github.com/git-lfs/git-lfs/fork |
| 173 | [pr]: https://github.com/git-lfs/git-lfs/compare |
| 174 | [style]: https://github.com/golang/go/wiki/CodeReviewComments |