编程知识 cdmana.com

Problems and solutions in Git application

Method 1( modify .git/config file ):
  step1: Enter the project .git Folder 
  step2:vim config
  step3: Add user name and mailbox at the end of the line :
        [user]
                name = xxx
		email = xxx@xxx
Method 2( Use the command to modify git User name and submitted email ):
    1.  Modify the global commands to :
    	git config  --global user.name  Your target user name 
        git config  --global user.email  Your target email name 
    2.  Modify the current  project The order is 
		git config user.name  Your target user name 
		git config user.email  Your target email name 

Two 、 solve git push error: failed to push some refs to

 The reason for the mistake is github Medium README.md The file is not in the local code directory , That is to say, we need to put any file in the remote code base first pull Go to the local code base , can push New code to github In the code base .
 Use the following command :
step1: First put any file in the remote code base first pull To the local code base
  git pull --rebase origin master
step2: Upload again :
  git push -u origin master

3、 ... and 、Git Become a branch master | REBASE 1/1 And the code is messy

Use git rebase --abort Solve the problem of code fallback

  • git rebase --abort

Four 、Git appear |MERGING solve

Enter the following command to jump normally :

  • git reset --hard head

5、 ... and 、Git View and switch branches

1. View all branches
  git branch -a
2. View the currently used branches ( The result list is preceded by * The sign indicates that the current branch is used )
  git branch 
3. Switch branches
  git checkout  Branch name 

版权声明
本文为[Swimming in the cold wind]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201225143437363i.html

Scroll to Top