Masterclass on Git & GitHub by REGex
Krushna Prasad Sahoo
★ O???S???? E??????? ★ R?? H?? C???????? S???????s? I? O???S???? A???? ★ Ass??. C???? E??????? (GCP) ★ M????s??? C???????? A???? A???? ★
Krushna Prasad Sahoo KIIT University, Bhubaneswar
Hello Peoples !!
I recently attended a 1.5 hours Masterclass on Git & GitHub. I got an clear overview on Opensource, Version Control Source & Collaborative Development, GIT & GITHUB workflows, some related terminologies such as commit, repo, branch, master merge etc.
1. What is the difference between pushing and pulling.. ?
- Push and Pull are two important operations with respect to GIT & GITHUB.
- Push - pushing sends the recent commit history from your local repository up to GitHub. If you're the only one working on a repository, pushing is fairly simple. If there are others accessing the repository, you may need to pull before you can push. eg. $ git push <option> [<Remote URL><branch name><refspec>...]
- Pull - a pull grabs any changes from the GitHub repository and merges them into your local repository. eg. $ git pull <option> [<repository URL><refspec>...]
2. How to initialize a new git repository ?
- Create a directory to contain the project.
- Go into the new directory.
- Do git init.
- Write some code.
- Do git add to add the files into staging area.
- Do git commit.
3. What is the use of git clone and how to use it ?
- The git clone is a command-line utility which is used to make a local copy of a remote repository. The git clone initializes a new Git repository in the team-project folder on your local machine and fills it with the contents of the central repository. After that, you can cd into the project starting modification of files, commitment of snapshots, and interaction with other repositories.
- A central repository indicates that all the changes from all the contributors pushed into this repository only. So, this is the most updated repository instance of itself. Sometimes this is often called as the original repository. Now, the image given below is pretty clear about the concept of cloning.
To use : $ git clone <repository URL>
4. How to ignore some files/folders from pushing ?
- gitignore file is a normal text file under your repository where we can mention the files and folders(directories) which we want to ignore while pushing . Just put .gitignore to your root folder and add ./assets/* to this file.
5. What do you mean by Branch?
- A branch in Git is simply used to work with different versions of a repository at the same time. By default a repository has a master branch. Any other branch is a copy of the master branch (as it was at a point in time). New Branches are for bug fixes and feature work separate from the master branch. When changes are ready, they can be merged into the master branch.
- Which branch should be used to keep deployment-ready code ? Answer : Master Branch or Release Branch
- Create a new branch called development from the main branch. Answer : git checkout -b development
- Checkout one more branch deployment from the previous branch. Answer : git checkout -b deployment
- Push different data into both branches. Answer : git push origin deployment development
- Merge data from both branches to the main branch. Answer : git merge development (when you are in master branch)
It was a great experience with #REGex Software Services . Thank You So Much .