intern_git_intro.md - brainchildservices/curriculum GitHub Wiki

Slide 1

Git & Version Control:

https://github.com/brainchildservices/curriculum/wiki/gitandversioncontrol.md

Slide 2

Create a .gitignore file in your project.

Make use of the below link:

To add or change your global .gitignore file, run the following command:

git config --global core.excludesfile ~/.gitignore_global

This will create the file ~/.gitignore_global. Now you can edit that file the same way as a local .gitignore file. All of your Git repositories will ignore the files and folders listed in the global .gitignore file.

Slide 3

  • Add .gitignore and README file when creating Repository directly from Github platform.

image

  • when you want to create Repository directly from Github, you can select Repositories and then browser will show a new button like above. Clicking on new button can take you to new Repo creating page.(below).

image

  • check both add .gitignore and add README file to initialise your repo with. so that both files will be easily added to your project.

Slide 4

GIT- How to

  1. Starting a new process- Create a new branch. Click on the branch name(bottom left corner) from where you want to create the new branch from. In the command palette type the name of new branch and create branch

image

then

image

enter the name of your branch

![image](https://user-images.githubusercontent.com/29180114/121848593-e1b2f900-cd07-11eb-88a8-83289a604517.png

you now working on the branch

image

Slide 5

  1. Make the changes and when the changes are done. Stage changes. Click on "Source Control" icon on the left hand pane. Click on the PLUS sign of the files you want to stage

image

  • this will stage the changes and make them ready to commit

image

Slide 6

  1. Once the files are staged, next step is to commit the changes. Enter meaningful messages for the changes you have saved and click on the tick mark

image

  1. Next stage is to push changes to Git. Go to terminal and type git push

    • When you push for the first time from a new branch you will get an error.
    • Copy the comment and paste it, run it to push the changes
  2. Once git push is success, you will see create pull request option. Press control click on link which will open the page that would allow you to create the pull request

  3. Important: Change the base branch to the one where you want to merge it

Slide 7

  1. In comments enter all the changes you have made and create pull request. Attach images if required.
  • image
  1. Take the url for the pull request and present to your mentor and wait for the approval. If it approved pull request ready to be merged.
  2. If changes are requested, go back to the program, make changes to the program, repeat steps 2,3 and 4
  3. If the pull request is merged, pull the changes to the local system. To do that, go to terminal type git pull origin baseBranchName