github interview questions

Github Interview Questions
Local warehouse: a folder built in the local
remote warehouse: a folder
distributed version control system built in a server on the Internet
1. Two warehouses with statements, a local warehouse on the computer, and a remote warehouse The server has a remote warehouse
2. When we submit files, we will submit it to the local warehouse first, and then submit it from the local warehouse to the remote warehouse on the network when there is a network.
3. GIT is a typical distributed version control system

Q. What is the difference between Git and GitHub

  • Git
    • Git is a distributed version control system used to track source code changes during software development. It helps to coordinate work between programmers, but can be used to track changes in any file set. The main goals of Git are speed, data integrity, and support for distributed nonlinear workflows.
  • GitHub
    • GitHub is a Git repository hosting service, and it also adds many of its own features. GitHub provides a web-based graphical interface. It also provides access control and some collaboration functions for each project, basic task management tools.

Q. What is Git

  • Git is a distributed version control system (DVCS). It can track file changes and allows you to revert to any specific version of the changes.
  • Every developer can "clone" a copy of the repository and have a complete history of the project on his hard drive, so when the server goes down, all the recovery data you need is in your teammate's local Git repository .
  • There is also a central cloud repository to which developers can submit changes and share them with other team members. As shown in the figure, all collaborators are submitting changes to the "remote repository".

Q. What language is Git written in?

  • Git uses the C language. Git is fast, and the C language makes it possible by reducing the runtime overhead associated with high-level languages.

Q. Some basic commands in Git and explain their usage

command usage
$ git clone Clone a remote warehouse
$ git init Initialize the local repository
$ git add . Keep track of all changed files
$ git status Check status
$ git commit -m “commit message” Submit all updated documents
$ git branch View branch
$ git branch Create branch
$ git checkout Switch branch
$ git merge Merge branch

Q. What are the commands submitted in Git?

  • The write submission command is git commit
  • If you need to submit a new file for the first time, you can git add before git commit -a

Q. What does the submission object include?

The commit object contains the following components

  1. A set of files representing the status of the project at a given point in time

  2. Reference to the parent commit object

  3. SHAI name, a 40-character string, unique identification of the submitted object

Q. What is the function of Git config?

  • Git uses your username to associate commits with identities. The Git config command can be used to change your Git configuration, including your username.
  • Suppose you want to provide a username and email ID to associate a submission with an identity so that you can know who made a particular submission.
    • git config -global user.name "Your Name": This command will add the username.
    • git config –global user.email “Your E-mail Address” : This command will add the email ID.

Q. What is a repository in Git?

  • The repository in Git is where Git stores all files. Git can store files in a local repository or a remote repository.

Q. How to create a repository in Git

  • To create a repository, first create a directory for the project (if that directory does not exist), and then run the command git init . By running this command, a .git directory will be created in the project's directory.

Q. Describe the following branch strategy you use

  • Functional branch

    • The feature branch model keeps all changes to a specific feature within the branch. When the functionality is fully tested and verified through automated testing, the branch will be merged into the main server.
  • Task branch

    • In this model, each task is implemented on its own branch, and the task key is included in the branch name. It is easy to see which code implements which task, just look for the task key in the branch name.
  • Release branch

    • Once the development branch has enough release features, you can clone the branch to form a release branch. Creating this branch will start the next release cycle, so no new features can be added after this, only bug fixes, documentation generation and other release-oriented tasks should be included in this branch. Once it is ready to be released, the version will be merged into the master server and marked with a version number. In addition, it should also merge the progress that has been made since its release back into the development branch.

Q. If the branch has been merged into master, by what means can you know?

  • To know whether a branch has been merged into master, you can use the following command:
    • git branch --merged It lists the branches that have been merged into the current branch. `
    • git branch –no-merged It lists the branches that have not yet been merged.

Q. What is "conflict" in Git

  • Git can handle most merges on its own using its automatic merge feature. A conflict occurs when two separate branches edit the same line in a file, or when a file is deleted in one branch but edited in another branch. When working in a team environment, conflicts are most likely to occur.

Q. How to resolve conflicts in Git

  1. Identify the file causing the conflict
  2. Make the necessary changes in the file to avoid conflicts again
  3. Add these files through the command git add
  4. Finally use the command git commit to submit the changed files

Guess you like

Origin blog.csdn.net/m0_47772488/article/details/108368510