Tuesday, March 17, 2020

Configuring Angular app with Devops Git

1) download the Git.exe from the internet
2) - To get the git version
   > git --version

-- To add the Devops project Git Repository to store the project files
   > git remote add origin https://VSMarket@dev.azure.com/VSMarket/VSMart/_git/VSMart

-- To verify the remote git Orgin path
   > git remote -v


-- Stage all the changes before commit
   > git add .

-- Commit all the changes with comment
   > git commit -m 'first commit'

-- Push all the code changes to the Devops Git Repository
   > git push --set-upstream origin master



Then in Visual Code
1) Install the Git repos extention
2) In the bootom blue color section , click on Team tab beside master* link
3) It will ask for Access token from your organization
4) Go to the Profile -> Under Security - select Personal Acces token --> click new token +  button
5) Give the requred fields , it will generate new access token
6) Remeber to store/copy this accees token, it will not show again.
7) paste in visual code and add from step 2 .

8) Now you are fully connected to Azure  Git repos


Steps to be followed to setup angular app and git repository in the system

Step 1:
-1- Create an azure account
https://portal.azure.com
--  Remeber username and password for microsoft account

-2- Download the visual studio code and install from below link
https://code.visualstudio.com/download
-3- download the git set up and install
https://git-scm.com/

Step 2:
-- Create a folder in local drives(D/E/F) and clone the code from devops.It will download the source code from devops repositorty
-- Go to the extentions tab on right side icon menu,in the search fieldd enter azure repos
-- In the extentions tab ,search git repos and install the extenstion
-- open the visual studio code - From menu options click on "Terminal" - select new termial
-- change the directory to  project folder , where the package.json file exists.
-- type below git commands
1) git remote -v - repository
2) git status  ---- changes
3) git add . -- after making any code changes and tested thoroughly
4) git commit -m 'write your comment'
5) git push

Step 3:
1) confgure angular in Windows OS is
a)  in command prompt > ng --version
    if the above command gives you error
  install cli
            npm install -g @angular/cli
b) In Windows OS

  •  Right Clicked on My Computer (windows)
  • Selected Advanced System Settings
  • Clicked "Environment Variables"
  • Under "Path" variable, made the FIRST value listed %AppData%\npm

c) Even if you are getting error use the below command
     Set-ExecutionPolicy Unrestricted -Scope CurrentUser

Step 4:
 1) In visual studio code , open the new terminal from Menu items
 2) Key board shot-cuts usefull while developement are
        ctrl + ' (tick )
        ctrl + c - to stop ng serve
3) Use full commands are
        1) "ng serve" == "npm start"
        2) "ng build" for local build & "ng build --prod" for production


Step 5: Use full git coomands to create a new branch and merge the changes to master branch

git branch - get the list of branches

git branch new_branch_name -  to create a new branch

git checkout new_branch_name - switch to new branch

After making the changes in new local branch, merge the changes to master(production branch)
 -- first switch to master branch, then merge the new branch code
git checkout master 
git merge new_branch_name

git branch -d new_branch_name --  delete the branch


No comments: