Friday 24 April 2020

GitHub - GitFlow , Feature and Development Branches , Push , Pull Request ( Coding Partners Intro )

This is specially written for the Coding Partners , our GitHub Repo - https://github.com/digital-cognition-co-in/DigitalCognition

You are requested to create a Branch so that you can complete your task and push the code . Steps to follow -

1/ Create a Local Clone - In an empty directory initialize a Git Repo.

$git init
Initialized empty Git repository in /media/dhankar/Dhankar_1/a2_20/kMeans/.git/
$git clone - https://github.com/digital-cognition-co-in/DigitalCognition.git
Cloning into 'DigitalCognition'...
Username for 'https://github.com': RohitDhankar
Password for 'https://RohitDhankar@github.com':
remote: Enumerating objects: 5887, done.
remote: Counting objects: 100% (5887/5887), done.
remote: Compressing objects: 100% (4012/4012), done.
remote: Total 5887 (delta 1580), reused 5867 (delta 1566), pack-reused 0
Receiving objects: 100% (5887/5887), 19.59 MiB | 5.94 MiB/s, done.
Resolving deltas: 100% (1580/1580), done.
Checking connectivity... done.


If required - $ cd DigitalCognition/

2/ Check the GIT STATUS - it should show that you are on BRANCH == MASTER
$ git status 
On branch master
Initial commit


3/ Check the Remote Branches  - this will show you all the BRANCHES created by others in your team . 

$ git branch -a
* develop
  master
  remotes/origin/Akshat
  remotes/origin/HEAD -> origin/master
  remotes/origin/Rohan
  remotes/origin/avirup
  remotes/origin/develop
  remotes/origin/master
 

4/ When you are 100% sure that you are on the BRANCH == DEVELOP , and can see the ASTERIX *develop  , you now need to create your own DEVELOPMENT BRANCH , which will track changes from the REMOTE Branch DEVELOP .Name your Branch as ---  

dev_yourFirstName_yourLastName

$ git checkout -b dev_rohit_dhankar
$ git branch -a
* dev_rohit_dhankar
  develop
  master
  remotes/origin/Akshat
  remotes/origin/HEAD -> origin/master
  remotes/origin/Rohan
  remotes/origin/avirup
  remotes/origin/dev_rohit
  remotes/origin/develop
  remotes/origin/master


5/ Once your  - dev_yourFirstName_yourLastName , Branch is created , you work on the task you are working on , once the task is complete , you can push the code to your branch on remote as seen below . 

$ git add .
$ git commit -m"App:dc_dash:utility_eda_only-Browser_storage__Client-side_storage"
[dev_rohit_dhankar 02cb376] App:dc_dash:utility_eda_only-Browser_storage__Client-side_storage
 1 file changed, 9 insertions(+), 5 deletions(-)


 6/ After pushing your code - create a New PULL REQUEST , this is as seen in the screencapture below .
 




After creating the NEW PULL REQUEST , compare changes with your -  dev_yourFirstName_yourLastName , Branch and the DEVELOP branch ,



 
 













$ git checkout -b develop

 Switched to a new branch 'develop'

$ git status
On branch develop
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
 

$ git add .
$ git commit -m"init_churn_app"
[develop 3a1452b] init_churn_app
 29 files changed, 18 insertions(+)
 create mode 100644 churn_app/__init__.py
 create mode 100644 churn_app/admin.py
 create mode 100644 churn_app/apps.py
 create mode 100644 churn_app/migrations/__init__.py
 create mode 100644 churn_app/models.py
 create mode 100644 churn_app/tests.py
 create mode 100644 churn_app/views.py
 rewrite dc_dash_proj/__pycache__/settings.cpython-35.pyc (83%)
 rewrite dc_dash_proj/__pycache__/urls.cpython-35.pyc (85%)


$ git push -u origin develop
Counting objects: 36, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (35/35), done.
Writing objects: 100% (36/36), 71.88 KiB | 0 bytes/s, done.
Total 36 (delta 10), reused 0 (delta 0)
remote: Resolving deltas: 100% (10/10), completed with 8 local objects.
remote:
remote: Create a pull request for 'develop' on GitHub by visiting:
remote:      https://github.com/digital-cognition-co-in/DigitalCognition/pull/new/develop
remote:
To https://github.com/digital-cognition-co-in/DigitalCognition.git
 * [new branch]      develop -> develop
Branch develop set up to track remote branch develop from origin.






Various Source --  https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow
https://gist.github.com/blackfalcon/8428401#make-sure-you-are-on-master
https://git-scm.com/docs/git-pull
https://www.atlassian.com/git/tutorials/using-branches

No comments:

Post a Comment