{"id":25543428,"url":"https://github.com/antoniof1704/git-contribution-guide","last_synced_at":"2026-02-06T03:30:18.605Z","repository":{"id":278356938,"uuid":"935329677","full_name":"antoniof1704/git-contribution-guide","owner":"antoniof1704","description":"This includes valuable guidance in the form of a README for users who wish to contribute to the main branches of a large project in a safe and efficient manner. I use this as a template to add to the READMEs of the projects I manage.","archived":false,"fork":false,"pushed_at":"2025-02-19T10:09:04.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-19T11:23:28.118Z","etag":null,"topics":["git","github-actions","r","rebase"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antoniof1704.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-19T09:16:27.000Z","updated_at":"2025-02-19T10:13:01.000Z","dependencies_parsed_at":"2025-02-19T11:34:11.823Z","dependency_job_id":null,"html_url":"https://github.com/antoniof1704/git-contribution-guide","commit_stats":null,"previous_names":["antoniof1704/guidance_for_git_repo_management"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoniof1704%2Fgit-contribution-guide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoniof1704%2Fgit-contribution-guide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoniof1704%2Fgit-contribution-guide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoniof1704%2Fgit-contribution-guide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antoniof1704","download_url":"https://codeload.github.com/antoniof1704/git-contribution-guide/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239793062,"owners_count":19697893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","github-actions","r","rebase"],"created_at":"2025-02-20T07:19:18.361Z","updated_at":"2026-02-06T03:30:18.550Z","avatar_url":"https://github.com/antoniof1704.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"## Want to Make Changes? \u003ca name = 'want_to_make_changes'\u003e\u003c/a\u003e\n\nIf you want to make changes or contribute to the project, please ensure you create a new branch from the 'main' branch (which should contain the most up-to-date code) to make your edits and test their functionality.\n\nThis can be done using the following commands in your R terminal. Please run each line one at a time:\n\n```\ngit branch\n\ngit checkout dev\n\ngit pull origin main\n\ngit checkout -b \u003cyour new branch name\u003e\n\n```\n\nThis should create a new local branch with the same code as the main branch (at the point of branching)\n\nIf you want to push changes made in your test branch to the repository, please run the following line in your R terminal:\n\n```\ngit add -a\n\ngit commit -m \"DESCITPION OF CHANGES\"\n\ngit push -u origin \u003cyour new branch name\u003e\n\n```\n\nOnce you are happy with the changes and your test branch has been pushed to the remote repository, please oragnise another team member to peer review your code. \n\nOnce this has been done, get permission to merge your changes onto the main branch.\n\nA merge request can be created by pressing 'New merge request' in the Gitlab.\n\nEnsure that you set the 'source branch' as the name of your test branch and the 'target branch' as the 'main' branch. If you are unsure on how to deal with conflicts or any other changes in the merge request, reach out to a team member who will be able to advise you. Make sure to select 'Delete source branch' to delete your test branch after the merge.\n\nOnce everything is ready, press the 'Merge' button, and your changes will appear in the 'main' branch. \n\n\n### Rebasing \n\nSometimes you will have instances where new updates or changes have been made to the 'main' branch. To prevent your branch from becoming out of date, you will want to rebase it with the most recent commits from 'main'.\n\nRebasing can be time-consuming if your code has diverged significantly from 'main'. For this reason, it's recommended to rebase your branch whenever a new merge occurs on 'main'. This will allow you to incorporate new changes from 'main' into your branch while preserving your own modifications.\n\nTo start the rebase, run the following lines of code in your R terminal. Please run each line one at a time:\n\n```\ngit branch\n\ngit checkout \u003cyour new branch name\u003e\n\ngit fetch origin\n\ngit rebase origin/main\n\n```\n\nThere will lilely be conflicts when you attempt to rebase. When a conflict occurs, your R terminal will look like this:\n\n```\nAuto-merging ..........\nAuto-merging ..........\nCONFLICT (content): Merge conflict in ..........\nCONFLICT (modify/delete): .......... deleted in HEAD and modified in .......... (Rebase 1).  Version .......... (Rebase 1) of .......... left in tree.\nerror: could not apply ............. Rebase 1\nhint: Resolve all conflicts manually, mark them as resolved with\nhint: \"git add/rm \u003cconflicted_files\u003e\", then run \"git rebase --continue\".\nhint: You can instead skip this commit: run \"git rebase --skip\".\nhint: To abort and get back to the state before \"git rebase\", run \"git rebase --abort\".\nCould not apply ............. Rebase 1\n\n```\n\nTo resolve the conflicts, you will need to open the scipts that are listed in the terminal and find the conflict within them. In the above example, I have two conflicts denoted by 'CONFLICT'. If I then open the .......... script, I will find the conflicting code, which will be highlighted in the following style:\n\n```\n\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\ndf2V1 \u003c- function(df1v1)\n\n=======\ndf2V2 \u003c- function(df1v2)\nprint(df2V2)\n\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e .......... (Rebase 1)\n```\n\nYou will need to decide which version to keep. If you are unsure which part to keep, contact another team member. \n\nTo do this, remove the unwanted code plus the additional formatting lines with \u003c or =. Again, using the example above, if I wanted to keep the first version of code (underneath the HEAD), I would need to remove all of the other code around it. See below:\n\n\n```\ndf2V1 \u003c- function(df1v1)\n\n```\n\nOnce all of the scripts with conflicts have been resolved, use the following command to continue with the rebase: \n\n```\ngit add .\n\ngit rebase --continue\n```\n\nAfter this, your terminal will enter into an interactive shell. To exit this please just type:\n\n```\n:q\n\n# and press enter\n```\n\nThere may be other commits to rebase with conflicts, so you will need to repeat the above process of rebasing until these are all resolved. \n\nOnce all of the commits have been rebased, the following message will appear in your terminal: \n\n```\nSuccessfully rebased and updated\n```\n\nRun the commands below, and you will have successfully rebased your branch and pushed the changes to the remopte repository.\n\n``` \n\ngit commit -m \"Successful rebase of my branch\"\n\ngit push -u origin \u003cyour new branch name\u003e\n\n```\n\nIf for whatever reason you need to stop the rebase, you can \nuse the command below, and this will abandon the rebase, returning your branch to how it was before. \n\n``` \ngit rebase --abort\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoniof1704%2Fgit-contribution-guide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoniof1704%2Fgit-contribution-guide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoniof1704%2Fgit-contribution-guide/lists"}