{"id":17040968,"url":"https://github.com/uggla/gitreco","last_synced_at":"2026-05-04T06:39:53.878Z","repository":{"id":148620598,"uuid":"119870806","full_name":"uggla/gitreco","owner":"uggla","description":null,"archived":false,"fork":false,"pushed_at":"2019-03-27T10:02:45.000Z","size":2178,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T19:59:23.092Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uggla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-02-01T17:40:12.000Z","updated_at":"2019-03-27T10:02:46.000Z","dependencies_parsed_at":"2023-05-20T17:30:35.333Z","dependency_job_id":null,"html_url":"https://github.com/uggla/gitreco","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":"0.11111111111111116","last_synced_commit":"61f52c3f31deb5e1350d3537a555bfe970b6cc1d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fgitreco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fgitreco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fgitreco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fgitreco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uggla","download_url":"https://codeload.github.com/uggla/gitreco/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245040189,"owners_count":20551301,"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":[],"created_at":"2024-10-14T09:10:59.861Z","updated_at":"2026-05-04T06:39:48.852Z","avatar_url":"https://github.com/uggla.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git\n\n## Overview\n\n- **Distributed** Version Control System.\n- Mostly used at Source Code Management.\n- Created by Linus Torvalds in 2005.\n- Latest version 2.16.\n- No master or hierarchy --\u003e projects can be easily forked.\n\n## Difficulties\n\n- Really powerful tool that can manage from local individual project to very large decentralized project (Linux).\n- Feature reach tool that lead to complexity.\n- Can be used completely with different manners/workflows.\n\n# TLDR\n\n- Always use a branch to work `git checkout -b \u003cbranch name\u003e`. Recommendation branch name should contain the jira ticket. \n- Synchronize your branch with devel every day using `git remote update` and `git rebase origin/devel`.\n- Create commits by topics. Use `git add -p` to select what should be part of the commit.\n- If needed, rebase your commits to cleanup history, before pushing your branch using `git rebase -i \u003cprevious commit\u003e`.\n- Open a PR and set your peers for review, make sure your PR pass the CI process and sonar report is fine with your new code.\n- Peers to review the PR and merge as soon as ready.\n- If needed (merge to master), tag the branch through bitbucket or using an annotate commit `git tag -a -m \"\u003cmsg\u003e'`\n\n## Git workflow\n\n![Git workflow](./git-workflow.png)\n\n- master reflects what has been delivered to production and *deployed* to production server.\n- release/\\* reflects the version that will be delivered or has been delivered to customer, but not yet *deployed* on production servers.\n- devel reflects the latest development that will be included in the next release.\n- master, release/\\* and devel branches are protected. (push cannot be done directly on the branch).\n\n![Bitbucket branch perm](./Bitbucket_branchperm.png)\n\nhttp://nvie.com/posts/a-successful-git-branching-model/\n\n## Feature branch\n\n- Create a local branch from **devel** `git checkout -b feature/my_feature`.\n- Develop your code, try to introduce tests to cover new code.\n- Push your branch to the remote `git push --set-upstream origin feature/my_feature`.\n- Open a PR from feature/my_feature to devel.\n- You can follow pipeline execution whithin Jenkins. Your code should pass successfully in the pipeline.\n- Also check sonar output to ensure produced code is free from critical bugs and vulnerabilities.\n- If pipeline successful, your reviewer can merge the PR into devel.\n\n\n## Release branch\n\nInitial branch creation.\n\n- Create a local branch from **master** `git checkout -b release/release_name`.\n- Push your branch to the remote `git push --set-upstream origin feature/release_name`.\n\nMerge content from **devel**.\n\n- Open a PR from devel desired state to release/release_name.\n- Merge the PR and tag the merge commit to the required version.\n- Also tag the commit before the merge commit to release_name_SNAPSHOT.\n\n![Release](./release.png)\n\n## Hotfix branch\n\nAdd fixes on top of either a release branch or master branch.\n\n- Create a local branch from **release** or **master** `git checkout -b fix/topic`.\n- Push your branch to the remote `git push --set-upstream origin fix/topic`.\n- Open a PR from fix/topic to release or hotfix.\n- Remove the release branch as soon as the code is deployed on production environment.\n\n![Hotfix](./hotfix.png)\n\n## Backport features from release or hotfix branches to devel\n\n**Only people with push rights can do this part.**\n\n- Merge fixes back to devel. `git merge --no-ff release/release_name\n\n\n# Pull request\n\n- All bugs, requests, features, ideas should be tracked into Jira tickets.\n- A release is a group of tickets that needs to be included and completed.\n- Use pull requests to review code by peers.\n\n![PR Step 1](./PR01.png)\n\n![PR Step 2](./PR02.png)\n\n![PR Step 3](./PR03.png)\n\n![PR Step 4](./PR04.png)\n\n![PR Step 5](./PR05.png)\n\n![PR Step 6](./PR06.png)\n\n- Close Jira tickets with merge commit id.\n\nProposal: reviewer of the PR will do the post synchronizations of branches.\n\n# Git zones\n\n![Git zones](./zones.png)\n\nhttp://ndpsoftware.com/git-cheatsheet.html\n\n\n# Best practices\n\n## Configure your git correctly\n\n```sh\ngit config --global user.name \u003cname\u003e\ngit config --global user.email \u003cemail\u003e\n```\n\nDo the above configuration on each machine you will use.\n\n\nUse ssh:\n\n- Setup your pubkey in bitbucket\n- Setup ssh-agent to avoid typing passwords\n- Update the remote definition of the repository from https to ssh using `git remote set-url origine \u003cssh url\u003e`\n- Check with `git remote -v`\n\nUse a difftool:\n\n- Setup a diff tool like vimdiff or meld. Note Jean Aymeric is a master of meld.\n\n## **Use** and abuse branches !\n\n- Always create a branch with a **topic** (feature, fix, ...).\n- Bitbucket, Github will use a branch to track your PR.\n- New branches can be created super easily !\n- Unsure about something, test it on a new branch.\n- But branch should not last for long and should be **deleted** !\n\n```sh\ngit checkout -b \u003cbranch name\u003e\n```\n\n## Save your work on a remote branch\n\n- Easy recover if you throw away commits (`git reset --hard \u003cold commit\u003e`) but finally need them.\n- Your local PC can crash !\n\n```sh\ngit push --set-upstream origin \u003cbranch name\u003e\n```\n\n## Commits\n\n- Do small commits.\n- Commit often.\n- Avoid large commit, love your reviewer.\n- Commit instead of stash.\n\n## Commit by topic\n\n- Use `git add -p`.\n- Refine commit with the lazer !\n- Avoid `git add -A` or `git commit -a`.\n- Use `git reset \u003cfile\u003e` if mistake.\n- Use `git diff --cached` to check what will be in the commit.\n\n## Do not commit\n\n- Secrets (private key, aws keys, etc...)\n- Avoid binaries\n\n## Synchronization, keep history as clean as possible\n\n- First thing you should do starting your job.\n- Use `git remote update`.\n- Rebase, rebase, rebase !\n- Never pull or use `git pull --rebase` ;) .\n- Really Avoid merge.\n- Branch finished, use `git merge --no-ff` this will create a merge commit and show that modifications are coming from a branch with a topic.\n\n## Think and clean before push\n\n- Refine/clean your local history using `git rebase -i \u003ccommit\u003e`.\n- Do not push like monkey on a permanent/public remote branch !\n- Things pushed to a remote branch can be extremely hard to correct. This is the danger zone !\n- Could lead to massive impact on developer work relying on this remote branch.\n- Never `git push --force` on a permanent/public branch !\n- A warning must ring in your head before using --force.\n\n## Conflicts\n\n- Use difftool or better mergetool to help resolving them.\n- If you need to restart the merging process from scratch on one file, use `git checkout -m \u003cpath/file\u003e`.\n- If you know that you should keep your file use : `git checkout --ours \u003cpath/file\u003e`.\n- If you know that you should keep remote file use : `git checkout --theirs \u003cpath/file\u003e`.\n\n## Tips\n\n- Merge ignoring whitespace. This is really usefull with xml files (pom.xml) that has been reformated. `git rebase origin/devel --ignore-whitespace -s recursive -Xignore-all-space`\n\n# Contribute to improve this doc\n\n# Thanks!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuggla%2Fgitreco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuggla%2Fgitreco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuggla%2Fgitreco/lists"}