Use Git To Add A File To A Repository
Use Git To Add A File To A Repository
1. Open a terminal.
2. Change directories until you are in your project’s folder.
3. cd my-project
The filename should be in red. The file is in your file system, but Git isn’t
tracking it yet.
9. Tell Git to track the file:
10. git add <filename>
The filename should be green. The file is tracked locally by Git, but has not
been committed and pushed.
13. Commit the file to your local copy of the project’s Git repository:
14. git commit -m "Describe the reason for your commit here"
15. Push your changes from your copy of the repository to GitLab. In this
command, origin refers to the remote copy of the repository.
Replace <branchname> with the name of your branch:
16. git push origin <branchname>
17. Git prepares, compresses, and sends the data. Lines from the remote
repository start with remote::
18. Enumerating objects: 9, done.
22. Writing objects: 100% (5/5), 1.84 KiB | 1.84 MiB/s, done.
24. remote:
27. remote:
28. To https://gitlab.com/gitlab-org/gitlab.git
Your file is copied from your local copy of the repository to the remote repository.
To create a merge request, copy the link sent back from the remote repository and
paste it into a browser window.