Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does git return specific return error codes?

Tags:

git

Like merging errors, or rebase errors. Does it have a unique error code?

like image 204
poymode Avatar asked Feb 07 '11 03:02

poymode


People also ask

Will git checkout overwrite local changes?

Checkout old commitsSince this has the potential to overwrite local changes, Git forces you to commit or stash any changes in the working directory that will be lost during the checkout operation. Unlike git reset , git checkout doesn't move any branches around.

What information does git status show?

The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven't, and which files aren't being tracked by Git. Status output does not show you any information regarding the committed project history.

What is the push command in git?

The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo. It's the counterpart to git fetch , but whereas fetching imports commits to local branches, pushing exports commits to remote branches.


2 Answers

In short, no. You're going to see exit code 1 for errors, and 0 for success.

From a quick grepping of the source, there are some of the expected 127 and 128 for their specific purposes (command not found, errors already reported), and a few unusual codes in a few places, but for run of the mill errors, it's all exit(1).

like image 194
Cascabel Avatar answered Nov 16 '22 11:11

Cascabel


I set-up a test to fail. This is what I got:

$ git merge newbranch Auto-merging test.txt CONFLICT (content): Merge conflict in test.txt Automatic merge failed; fix conflicts and then commit the result.  $ echo $? 1 

Git returns 0 when it merges correctly, as expected.

like image 29
chrisaycock Avatar answered Nov 16 '22 13:11

chrisaycock