Book Image

Git Best Practices Guide

By : PIDOUX Eric
Book Image

Git Best Practices Guide

By: PIDOUX Eric

Overview of this book

Table of Contents (12 chapters)

Fixing errors by practical examples


This section will help the readers a lot because the errors mentioned can occur very frequently. This will summarize the entire chapter. Sometimes, especially when you are not really familiar with Git, you don't know how to fix it. Here are the most common errors that will occur:

  • Remote origin already exists: This error occurs when you already have a remote repository specified and the remote origin removed and added:

    Erik@server:~$ git remote rm origin
    Erik@server:~$ git remote add origin https://github.com/sexyboys/InflexibleBundle.git
    
  • Git push fails with rejected error: This error occurs because you didn't execute git pull before git push:

    Erik@server:~$ git pull
    Erik@server:~$ git push
    
  • Git push fails with "fatal: The remote end hung up unexpectedly": This one is common and you should check whether your remote URL is correct and Git has access to the remote repository.

  • Restoring a changed file to its last committed state: Run git checkout followed...