Git | 212 Views

Beginner’s Guide to Push and Pull in Git Repositories

's Gravatar
Feb 12, 2023

NOTE : ALL THE CHANGES ARE MADE IN DEVELOPMENT BRANCH

=============================================================================

1. How to make development branch

a. Squash Process
i. Go to development branch => git checkout development
ii. Run merge command => git merge –squash master

b. Delete and create development branch
i. Go to master branch
ii Check branches list => git branch
iii. Delete development branch => git branch -d development
iv. Create development branch => git branch development
v. Checkout development branch => git checkout development

Shortcut for iv and v => git checkout -b development

4. Pull changes from GITLAB repo development branch => git pull <repo_link> <branch_name> eg: git pull https://gitlab.com/shrroshan/attendance.git development

2. Add changes to staging => git add .

3. Commit changes to local repo => git commit -m “Message”

5. Push changes to GITLAB repo development branch => git push -u <repo_link> <branch_name> eg: git push -u https://gitlab.com/shrroshan/attendance.git development

6. Send Merge Request in GITLAB repo
i. Select master branch for merge
ii. Select Reviewer, Approval
iii. Uncheck Delete branch
iv. Check Squash

7. Go to master branch in working directory

8. Pull changes from GITLAB repo master branch => git pull <repo_link> master eg: git pull https://gitlab.com/shrroshan/attendance.git master
Go to development branch in working directory
9. Pull changes from GITLAB repo development branch => git pull <repo_link> <branch_name> eg: git pull https://gitlab.com/shrroshan/attendance.git development

Additional Commmands
===============================
git status

git log

git log –oneline

Process

git pull <repo_link> development
git add .
git commit -m "Message"
git push -u <repo_link> development

master page

git pull <repo_link> master

 

Important
==============
1. Check if your committed codes are in the development as well as in master branch in gitlab server

Technique for pushing file in development branch
1. git stash
2. git pull <repo_link> master
3. git stash pop

Resolve any conflicts arised after so.

Then
4. git pull <repo_link> development
5. git add
6. git commit
7. git push
8. request for merge