git common interview questions

#####################################

If the code appears bug, how do you solve? 
Create a bug branch, then bug treatment, after treatment is completed, the merger review branch, head of the review before we can successfully merged into the master 
deletion bug branch after the completion of the merger 
back to dev branch continue to develop.

 

###################################

? git rebase role 
scene: in developed forget to submit to github hosting, but also continue to develop new features in the home, 
and then to the company yesterday code merged with your new feature can be used when fecth git ---> git rebase 
then he submitted records will not appear bifurcation, maintained a clean record submitted.

 

###################################

Who will do the code review? 
Do Code Review
   - leader
   - with your people

 

#################################

How do code review? 
Create a review branch, and then create your own personal branch, when you complete your business logic of the time, 
and then incorporated into the review branch. Leader to do code review

 

###############################

Use github or gitlab? 
Use the github, because the company is relatively small, so there is no build their own gitlab, 
but with github when coding must be confidential, and $ 900 to build a warehouse

 

###############################

He cited the work of several commonly used git command? 
New file commands: git add file or git add. 
Submit the command file: git commit -m or git commit -a 
view workspace status: git status -s 
pull operations into remote branch: git FETCH / git or Merge git pull 
View submit records command: git reflog

 

################################

Conflict during commit, can you explain how the conflict is to produce it? How did you solve? 
The development process, our branch has its own characteristics, so not much conflict, but also encountered. Public method such as a public, I and others modify the same file at the same time, he submitted me to submit error will be reported conflict. Conflict, usually compare local files and remote branch files inside the IDE, then the contents of the file manually on a remote branch changes to a local file,
and then submit it to ensure that conflicting files and remote branch of the same file, so that it It will eliminate the conflict, and then submit some of their modification.
Particular attention, the conflict modified file to keep it local and remote file repository after agreement, to be submitted later to eliminate the conflict, or can not continue to be submitted. If necessary, communicate with colleagues, eliminate the conflict.

 

####################################

You used the git stash command it? Under normal circumstances you would use it? 
Git stash command in the stack is the work area to modify the contents of the storage area. The following conditions to use it: When resolving conflicts file, it will first execute git stash, and resolve conflicts; developing an emergency development task but the task can not be submitted, will first execute git stash, then an urgent task, then pop out the contents of the stack area by git stash continue to develop; when switching branch, the current workspace can not submit content, will first execute git stash branch then switch;

 

########################################

How to view the history of the branch submitted? View the history of a file it? 
View branch of the submission history: 
command git log -number: View number represents a detailed submission history before the current branch; 
command log -number -pretty git = oneline: simplifying the basis of the previous command, the display only sha- 1 yards and submission of information; 
command git reflog -number: number represents a simplified view of history before the submission of all branches; 
command reflog -number -pretty git = oneline: simplified information display historical information;

 

#######################################

git pull and git fetch What is the difference? 
new changes git pull command to extract specific branch from a central repository or submit and update local branch target repository. 
git fetch also used for the same purpose, but it works a little differently. When you run git fetch, 
it will retrieve all new submission from the desired branch, and the new branch is stored in a local repository in its. If you want to reflect these changes in the target branch,
it must be performed after the git merge git fetch. Only after the branch target branch of the merger and acquisition will update the target branch.
For your convenience, please remember the following equation: git pull
= + FETCH git git Merge

 

#######################################

 

Guess you like

Origin www.cnblogs.com/andy0816/p/12508162.html