Git Basics

For more information, check out the Git Documentation

Sharing and Updating Repositories

Git Pull

git pull <options> <repository>

Pulls changes from a remote repository into the current branch. If the current branch is behind the remote, then by default it will fast-forward the current branch to match the remote.

Git Status

git status

Displays paths that have changes between your local repository and the HEAD of the remote repository

Git Add

git add <changes to be staged>

This command updates the index using the current content found in the working tree, to prepare the content staged for the next commit. To stage all changes, use git add .

Git Commit

git commit -m <"Commit Title">

Create a new commit containing the current contents of the index and the given log message describing the changes.

Git Push

git push origin main

Updates the main branch of the remote repository based on the last local commit

Branching and Merging

Git Branch:

git branch

Lists all existing branches; the current branch will be highlighted in green and marked with an asterisk

In branch management we have master or(main) for production release, and for development we have dev, develop or release* baes on release number we having.

Ex : Our current prodcution release 2.9.2 and this solution already deploy, and when we have other new development we create other branch base on master or (main), if we want to create new feature or fix bug into existing project we need to update with latest branch in development.

Git Checkout:

git checkout -b <"new branch name">

or

git checkout <existing branch name>

Source Code Management with Git

Introduction

For source code management we use git lab, with url https://gitlab.initcapp.com and all project have group in gitlab.

Get start with development

When we start to develop any feature we must to create issue in gitlab and create new branch After checkout that we need to do in this branch only, And after we done feature, we need to sent merge request (MR) for merge code into dev, develop or release*.

Flow number for feature

1. Create issuse in gitlab https://gitlab.initcapp.com/<projectname>/-/issues
2. Create new branch 
3. Checkout into this branch 
4. After done dev merge this into current development branch `dev, develop or release*`, will be review by top managment. 
5. After code done and have no issue, the least source code in `dev, develop or release*`

if we have any issue on production base on we can check with release number and fix the issuse.

Last updated