Git and GitHub REGex Workshop Task

Git and GitHub REGex Workshop Task

Q1. What is the difference between pushing and pulling ?

Ans. Pushing is used to push the source codes into an SCM Cloud tool which everybody or privately can see your source code and use it also as well whereas Pulling is used to pull the source codes from an SCM Cloud tool from someone's which is need to use it. In Git we can able to do pushing and pulling by using an command ->

Pushing -> git push <folder_name>

Pulling -> git pull <Repo_name>

Q2. How to initialize a new git repository? Describe all the steps.

Ans. Step-1 -> To initialize an git repository, before we need to initialize it which are used to put a source code in SCM tool. So, we need a that command ->

git init

Step-2 -> After that command, It creates a .git folder which is an hidden folder. So, we need to prepare all changes into an staging area means we need to add a files on that current folder into an local repository. So, For this we use that command

git add .

Step-3 -> After that command, It stages all the files into that present directory and its ready to commit that file. So, That area which creates a backup is called commit area. Now, we need to commit the stages files by using that command.

git commit -m "First commit message"

Step-4 -> Now, Copy the remote repository URL which is provided by GitHub after creating an new Remote Repository in GitHub in public or private access. Now, we will add the Copied URL for your GitHub Repository as remote repository by using that command ->

git remote add origin https://github.com/<username>/<remoterepo>.git

It will add a connection between the local and remote repositories.

Step-5 -> At last step we need to pull the files into an remote repository by saving the code in SCM Cloud Tool GitHub through git by using that pull command ->

git push -u origin master

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

Ans. Step 1: Obtain the Git repository URL -> All remote repositories, such as GitHub, GitLab or even a custom one that an organization hosts on the local network, have a URL associated with the repository. This tutorial uses GitHub, and you can find the repository URL when you click on the Clone or download button on the repository's GitHub page.

Git URL: https://github.com/<username>/<remote-repo>.git

Copy this URL to the clipboard because you'll need it in a future step.

Step 2: Run the git clone command -> With the Git URL copied, open a terminal or command window in the folder where you will maintain the remote repository and issue the git clone command:

git clone https://github.com/<username>/<remote-repo>.git

As the git clone command executes, the local system will download the contents of the remote repository, including all the remote references to Git branches and the contents of the current workspace.

Step 3: Validate the cloned repository -> After the "git clone" command completes, validate the downloaded repository. Navigate into the subfolder that contains the cloned data and check if the working directory has the files listed on the server. In this example, a valid cloned repository means seeing files such as "game.html" and "pom.xml" in the listing.

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

Ans. We can able to ignore some files/folders from pushing using the ".gitignore" file. Gitignore file is a normal text file under your repository where we can mention the files and folders(directories) which we want to ignore.

Some steps to follow to ignore some files/folders from pushing are ->

  • Go to .gitignore file and add the entry for the files you want to ignore.
  • Run "git rm -r --cached"
  • Now run "git add ."

Q5. What do you mean by Branch?

Ans. A branch is essentially is a unique set of code changes with a unique name. Each repository can have one or more branches. This is the official working version of your project, and the one you see when you visit the project repository at "github.com/yourname/projectname". Do not mess with the master.

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

The developers in the team constantly commit their work into a single, central branch- which is always in a deployment-ready state. In other words, the main branch for the project should only certain tested and quality work, and should never be broken.

  • Create a new branch called development from the main branch.
  1. git branch main
  2. git checkout -b development
  3. git push -u <remote_repo_name> development
  • Checkout one more branch deployment from the previous branch.

Select the branch that you want to merge into current branch and choose Merge into Current from the submenu.

If you need to specify merge options, from the main menu choose VCS Git | Merge Changes to open the Merge dialog

  • Push different data into both branches.

Apply Already existing commit to another branch using "cheerypick" command, and them push both branches using git push origin branchA and branchB.

  • Merge data from both branches to the main branch.

Merging your branch into master is the most common way to do this. Git creates a new commit message(-m) that is referred to as a merge commit that results from combining the changes from your feature branch and master from the point where the two branches diverged.

"THANK YOU FOR READING"

To view or add a comment, sign in

More articles by Prabhjeet Singh

  • RedHat Linux Menu Program

    Hello Everybody, Welcome to my article based project for covering these two points -> Make a user in RHEL8 Machine give…

    12 Comments
  • How LinkedIn Uses JavaScript

    Actually, we already known most of the application including the website are creating using JavaScript for the…

    8 Comments
  • Cyber Attack in Confusion Matrix Case

    Actually, we are in the world of computer science. Most of the data that are very important to us or the data which…

    8 Comments
  • Microsoft Case Study of Ansible

    Hello Everybody, I hope you all fit and fine as always. So, I presented a blog for the introduction of ansible and its…

    2 Comments
  • Setup for Ping Google but not Facebook for the same system

    Hello Everybody please read my article for that setup in same system that pinging with google but not with facebook…

  • Increase and Decrease the Size of the Static Partition

    For increasing or decreasing the static partition we need to follow these steps : Step1: Go to that VM setting Attach…

    4 Comments
  • Experience of 2 Days Git and GitHub Workshop

    "TOH KESE HAI AAP LOG" First of all , I would like to really thank you to that my mentor World Record Holder Mr. Vimal…

    23 Comments
  • Twitter: A Data Analyzer for Machine Learning

    What is Machine Learning? Definition of Machine Learning According to Tom M. Mitchell is - “Machine learning is the…

  • Create High Availability Architecture with AWS CLI

    Hello Connection, Welcome to you all to my article based on Task-6 of ARTH- The School of Technologies for AWS CSA &…

    4 Comments
  • Case Study of Amazon Prime from AWS

    So, Amazon has many products like Amzon.com, Amazon prime, Amazon Pay etc.

    8 Comments

Others also viewed

Explore content categories