Skip to content

ZararAhmed/GIT-WORKFLOW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

Git Workflow

1. To start a project

  1. Clone the repository
    $ git clone <remote-url>

2. To do new feature/modify/hotfix

  1. Checkout into dev branch
    $ git checkout dev
  2. Pull the latest changes
    $ git pull origin dev
  3. Create a <branch-name> branch from dev branch
    $ git checkout -b <branch-name> dev
    # branch-name must contain add/, modify/, fix/ or hotfix/ 
    # e.g. add/feature-name for new feature or hotfix/bug-name for hotfix
    
    # push new-branch to remote repository
    $ git push -u origin <branch-name>
  4. Make changes and commit each logical change with descriptive message

3. To commit the changes

  1. Inside your working branch
    # check the changed files
    $ git status
    # make sure only files are modified which you intend to
    
    # stage the changes
    $ git add file1 file2 file3 ...
    
    # to stage all changes at once 
    $ git add .
    # make sure any file you didn't change shouldn't appear in red in git status
    
    # commit the changes
    $ git commit -m "[TICKET-NO/ISSUE-NO][Add/Modify/Fix/Hotfix] <MESSAGE>"
    # Message must be descriptive and relevent to the changes in the code

4. To submit merge request

  1. Checkout into dev branch and pull any new changes
    $ git checkout dev
    $ git pull origin dev
  2. Checkout into your working branch and merge with dev
    $ git checkout <branch-name>
    $ git merge dev
  3. Resolve the conflict if any and commit the changes as discussed above
  4. Push the branch and create the merge request
    $ git push -u origin <branch-name>

5. To delete a block of code (Dead Code Removal)

  1. Comment the block of code and make your required changes
  2. Commit the changes describing the changes you made as discussed above
  3. Delete the commented code with this message format
    $ git commit -m "[DCR] <Describe the code block functionality>"

About

Standard workflows for working with git. Clone, Pull, Commit, Push, Merge, DCR

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •