Git


Useful commands

1. to combine "git add" and "git commit -m" use "git commit -am"
2. Never use forced push "git push --force"  
3. Daily run "git pull origin master"
4. ".gitignore" file
4.1 name ////file name OR directory name
4.2 name/  ///// only directory name
4.3 **name //// directory in any subfolder

Settings

1 core.autocrlf
git config core.autocrlf input
1.1 "input" if repository on Unix
1.2 "TRUE" if repository on Windows
1.3 "FALSE" if common platform for development and repository. 

2. Editor
git config --global core.editor "path of the editor" 

3. git commit message template
git config commit.template "path"
The message is visible at output of "git log" command  


Branch name:
changeType=[bug | feat]/[bug id | feature id]/short-name

Central Repository

1. GitLab : Depends on curl, ca-certificates, openssh-server
1.1 code repository
1.2 issue trackers
1.3 wikis
1.4 CI/CD tooling / integration (GitLab runner) 
1.5 docker container registry.
1.6 code snippets store area (gist feature)

Issues are added to Backlog by default. They are grouped as milestone

commit message should have keyword like 1. Fix 2. Fixes 3. Close 4. Closes and then some number. So GitLab will automatically update status of that issue pointed by the number.

In merge request we can add "\spend 1h"  

2. git init -bare

3. Github : REST API

4. BigBucket : integration with Jira and Confluence 

Different Branches

1. long running branch : master, develop
2. feature branch

3. hotfix branch

Branching Strategy 

1. TBD Trunk Based Development

2. GitFlow: Develop branch from Master branch. Multiple feature branches from Develop branch. After all feature branches merged back to develop branch, new release branch created. All bug fixes happen in release branch. Finally release branch merged to master. Hotfix branch from master for emergency. Develop and master both branches are controlled by maintainers. 

CI Tools

1. Jenkins (CloudBees for cloud hosted) 

2. GitLab : Using "GitLab Runners"

Installation : https://docs.gitlab.com/runner/install/
Register 
Add file ".gitlab-ci.yml"

3. TFS Team Foundation Server (MicroSoft) Integrated with Visual Studio

Reference:

http://nvie.com/posts/a-successful-git-branching-model

https://barro.github.io/2016/02/a-succesful-git-branching-model-considered-harmful
http://try.github.io/
https://github.com/zendframework/maintainers

0 comments:

Post a Comment