Skip to content

Latest commit

 

History

History
71 lines (60 loc) · 2.49 KB

git-commands.md

File metadata and controls

71 lines (60 loc) · 2.49 KB

Pre-requisite

  1. install git.
  2. Preferably, SSH key based github authentication due to its ease than token based over HTTPS url.
    i) generate ssh key
    ii) add ssh key to github
    iii) test ssh key based github auth

To contribute new fetaure

Following is simple step-by-step procedure to contribute to repo through git.

  1. clone the main repo
git clone [email protected]:datakaveri/iudx-deployment.git && cd iudx-deployment
  1. Fork the git repository from github UI and get the git clone ssh url of the forked repo ref : https://docs.github.com/en/get-started/quickstart/fork-a-repo

  2. Add git remote of your fork,

git remote add my-fork <fork-git-clone-url>
  1. sync your local git with remote origin (i.e. main repository)
git pull origin master
  1. create a new feature branch from master of remote repo
git checkout -b <feature-branch-name> 
  1. Do all your file/folder changes in this branch

  2. Review files and see changes of git tracked files

git diff <git-tracked-files>
  1. Add files to staging
git add <file>
  1. Before commit, review files to be commited (i.e. those in staging) using git status
  2. Commit files (only files in staging will be commited) and add appropriate message in the editor
git commit 

The commit message preferrably must contain one line heading covering what commit does. A detailed explanation (if required) in points as shown below:

Adding git docs 

- This is a step by step procedure for git contribution
  to the repo
  1. Push the changes to you fork remote
git push my-fork  <feature-branch-name>
  1. After pushing the commits, click on the PR url displayed in terminal. Alternatively, can also create PR from github UI. ref: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork

Other miscellaneous commands

  1. To fetch branch from others fork
    1.1 Add the thier fork git remote other-fork <fork-git-clone-url>
    1.2 fetch the branch git fetch other-fork <branch-name>