An Article on GIT and GITHUB
TASK BASED ON GIT & GITHUB MASTERCLASS

An Article on GIT and GITHUB


No alt text provided for this image

1. What is the difference between pushing and pulling..?

Pulling - Pulling is the opposite of pushing. It allows you to make changes in your local repository from any remote location. it's more useful in group work or a big project where more than one person can submit changes to a single repository

Pushing - Pushing sends your changes up to GitHub, so they can be shared with your project teammates. It also serves as a hedge against data loss.

suppose if you are working on the repository alone then it's easy to push. but If there are other members who want to access the same repository then you need to pull before you push up to GitHub


2. How to initialize a new git repository [ Describe all the steps ] ..?

There are few steps to initialize a new git repository -

  1. We need to create a directory on GitHub to contain the project.

2. Go to the newly-created directory.

3. Open git bash and type - git init (to initialize the new repository).

4. Write something codes and type - git add ( to add the files into our repository ).

5. Then type - git commit (to save your file in the repository ).


3. What is the use of git clone and how to use it?

git clone is mainly used to selecting an existing repository and make a copy of that repository in a new directory, at another location. The original repository can be located on the local machine.

No alt text provided for this image










?Steps to make git clone -

1. Open git bash.

2. Go to the repository which we want to make a clone.

3. Type - git clone <repository URL> ( to make a copy of the existing repository ).

4. After making any changes in the cloned repository you need to commit every time because it will not change in the original repository.

5. When you complete your work you can push it into GitHub.


4. How to ignore some files/folders from pushing?

To ignore files/folders we need to create a .gitignore file in your Git repository to prevent Git from staging unwanted files. Share .gitignore in the default branch in your repository. You and your teammates can update the file to change which types of files to ignore.

5. What do you mean by Branch?

A branch represents an independent line of development. The git branch command lets say create, list, rename, and delete branches. It doesn't let us switch between branches or put a forked history back together again.

- Which branch should be used to keep deployment-ready code?

In GitHub, the main branch contains our production-ready code. The other branches contain work on new features and bug fixes. 

- Create a new branch called development from the main branch.

$ git branch development

- Check out one more branch deployment from the previous branch.

$ git checkout development

$ git checkout -b development

- Push different data into both branches.

$ git push -u <remote> development

- Merge data from both branches to the main branch.

$ git merge new-feature

Dipali Goyal

Software Engineer II at JPMorgan Chase & Co.

3 年

Good work ??

回复
Sayyed Nargis Fatima

ERP Business Analyst at Schneider Electric, Bangalore, India.

3 年

Well done??

回复

要查看或添加评论,请登录

Saurabh Sinha的更多文章

  • Task-Based on both Docker Sessions of the masterclass

    Task-Based on both Docker Sessions of the masterclass

    what is docker Docker is an open-source platform for building, deploying, and managing containerized applications…

  • TASK BASED ON LINUX SESSIONS

    TASK BASED ON LINUX SESSIONS

    1) Create a file via Touch and update that file and also verify the timestamp and output will be redirected to another…

    2 条评论
  • An article on the importance of optimization

    An article on the importance of optimization

    what is optimization? Maximizing or minimizing some function relative to some set, often representing a range of…

    6 条评论

社区洞察

其他会员也浏览了