User Registrationhttps://openforge.gov.in • You will receive a verification email on your registered mail Id. • Click on the verification link to validate the registration • Once validated login to OpenForge • Make Sure to select Account type as Individual • Click on Register New Project
Project Registrationhttps://openforge.gov.in • Fill the details on the project registration page • Select Private Project • Click on agree to Policiy
Adding Project Membershttps://openforge.gov.in Add users to project Add NIC Coordinators to the project as per instructions . Click on User Permissions
Project Users Rightshttps://openforge.gov.in NOTE:- Provide admin rights to NIC Coordinator(s).
GIT – Introduction • Version Control ? - Version control systems are a category of software tools that help a software team manage changes to source code over time. • What is GIT? - By far, the most widely used modern version control system in the world today is Git. Git is a mature, actively maintained open source project originally developed in 2005 • Why GIT? - Relying on software for mission-critical applications, altering your development workflow impacts your entire business. Git isn’t just for agile software development—it’s for agile business. • Install GIT – Visit https://git-scm.com/downloads & follow steps to download/install according to respective Operating System (OS). • GIT Cheat Sheet - https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet or Refer GIT Documentation - https://git-scm.com/doc
GIT Fundamentals - First Time Setup • git --version to check if git is successfully installedgit version 2.9.0.windows.1 • Set config values git config --global user.name “<Your Name>”git config --global user.email “<YourEmail@abc.com>” • Get config values git config --list • GIT Help git help <verb>git <verb> --helpe.g.:git help configgit config --help
GIT Fundamentals – Getting Started 1st Scenario • 1st Scenario – Initialize from Existing Codegit initInitialized empty Git repository in /your/working/directory/path/.git/ • Check Status:git status • Add GITIGNORE – To ignore personal preferences files like configurations, Database parameters, folders, etc.just create .gitignorefile and add your preferences:.project .settings/ *.zip
GIT init, status & gitignore Before without .gitignore After adding preferences to .gitignore
GIT Fundamentals – Adding & Committing • Start adding your changing to staging area:git add -A : To add all filesgit add /path/to/file.ext: To add a specific file • Check using git status • Remove file from staging area:git reset : To remove all filesgit reset /path/to/file.ext: To remove specific file • Our 1st Commit:git commit –m “Your ComitMessge” To Commit using proper Messagegit commit --amend –m “Your Commit Message” To Rectify Commit • Use git log to see summary about commit which provides unique hash commit id, author, Date-Time of commit and Commit Message • We have now successfully tracking our local project
GIT Fundamentals – Getting Started 2nd Scenario • 2nd Scenario – Cloning a Remote Repositorygit clone <url> <[where_to_clone]> • Check your working directory to see the list of Files & Folders cloned from repository. • View Information about Remote Repository:git remote -v • View Information about Remote Branch:git branch -a • Do some changes and commit your code.:git diffgit statusgit add -Agit commit –m “Your Message”
GIT Fundamentals – Push & Pull of a Repository • After committing your code it’s always a best practice to pull remote changes before pushing your code to the repository as other developers may have already sent their changes to repository.git pull <origin-name> <branch-name>git pull origin master • To push your changes to repository use git push command.git push <origin-name> <branch-name>git push origin master
GIT Pull From & Push to Repository Git Pull Git Push
GIT Fundamentals – Common Workflow • Create a Branch for desired featuregit branch <branch-name>git branch MyFeature@TaskID– Obtained from tracker • To List Branch:git branch* Before a branch denotes current branch • To Change Branch:git checkout <branch-name>git checkout MyFeature@TaskID • Work on your task and commit. • After commit push branch to remote:git push origin <branch-name>git push origin MyFeature@TaskID
GIT Fundamentals – Fetch a Branch • Now the branch is available in repository for others to use for the purpose of Unit Testing, Security Testing, Code Review, etc. • There is a 2 way to fetch branch:git fetch origin MyFeature@TaskIDgit checkoutMyFeature@TaskID ORgit checkout ‐b MyFeature@TaskID git pull origin MyFeature@TaskID • After Successful Auditing of your branch, it is ready to be merged into master.
GIT Fundamentals – Merge a Branch • Go to master branch:git checkout master • Pull Changes from master branchgit pull origin master • Check merge statusgit branch --merged • Merge branch into mastergit merge MyFeature@TaskID • Push changes after mergegit push origin master
GIT Fundamentals – Merge Conflicts • Sometimes you get merge conflicts when merging into or pulling from a branch. • Merge Conflict is caused by competing line changes, such as when people make different changes to the same line of the same file on different branches in your Git repository. • To immediately get out of conflict or to resolve conflict later use:git merge --abort • Merge conflicts had to be resolved manually. But there are tools like Meld(http://meldmerge.org/) , DiffMerge(https://sourcegear.com/diffmerge/) & many other tools which makes resolving conflict easier by providing a GUI.
GIT Fundamentals – Tag a Release • Tagging is basically versioning your release, After merging a branch mention about your changes added/removed from your software in a version management page or a simple text file.E.g. vi version.txtBootCamp 1.0.1, 31/08/2017 ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ‐ Features: * Added captcha in login ‐ Bugfix: * Footer issue resolved • Add you changes and commitgit add version.txtgit commit ‐m “release/1.0.1” • Tag your releasegit tag -a v1.0.1 -m "my version 1.0.1" • Push your tags to repositorygit push origin –tags • * Release management depends upon the workflow adhered by your organization, it can be before merging or after merging to master.
GIT Fundamentals – Delete a Branch • After merging of a branch we can delete the branch since it is no longer necessary • Check Merge status of a branchgit branch --merged • Delete branch locallygit branch -d MyFeature@TaskID • Check/List about Branchgit branch -a • Delete Branch from Remotegit push origin --delete MyFeature@TaskID
GIT Fundamentals – Summary • Clone a Repository • Create Branch • Do Changes (Task/Bugfix) • Add Changes to Staging • Commit Changes to Local Repository • Push Changes to Remote Repository • Merge Changes into Master • Release version using Tag • Finally Delete Branch after Merging
GIT Fundamentals – References • GIT Website (https://git-scm.com/) • Atlassian Website (https://www.atlassian.com/git) • Git Tutorial for Beginners (https://www.youtube.com/watch?v=HVsySz-h9r4) • Google Images for some Pictorial Diagrams.
Thank You By OpenForge Team