Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

slight doc and message improvements

For consistency and better guidance.

Signed-off-by: Simon Thum <simon.thum@gmx.de>
  • Loading branch information...
commit c2dbf9264a4241b35afcc209cd69088e9f41c4ff 1 parent e4cccc5
@simonthum authored
Showing with 26 additions and 20 deletions.
  1. +16 −10 README.md
  2. +10 −10 git-sync
View
26 README.md
@@ -16,9 +16,11 @@ Unlike the myriad of scripts to do just that already available,
it follows the KISS principle: It is safe, small, requires nothing but
git and bash, but does not even try to shield you from git.
-It is ultimately intended for git-savy people. Tested on msysgit and a
-real bash. In case you know bash scripting, it will probably make your
-eyes bleed, but for some reason it works.
+It is ultimately intended for git-savy people. As a rule of thumb, if
+you know how to complete a failed rebase you're fine.
+
+Tested on msysgit and a real bash. In case you know bash scripting, it
+will probably make your eyes bleed, but for some reason it works.
### What does it do?
@@ -40,8 +42,10 @@ be safe.
Just call `git-sync` inside your average joe's repository (not in the
middle of a rebase, git-am, merge or whatever, not detached, no
-untracked files) and everything will likely just work. If you don't
-push in an intertwined manner, `git-sync` is virtually guaranteed to work.
+untracked files) and everything will likely just work. Else, a clear
+error message should appear. If you don't sync in an intertwined
+manner (from multiple repositories/machines), `git-sync` is virtually
+guaranteed to work.
## How does it work?
@@ -49,7 +53,7 @@ The flow is roughly:
1. sanity checks. You don't want to do this in the middle of a rebase.
2. Check for new files; exit if there are, unless allowed in config.
-3. Check for auto-commitable changes.
+3. Check for auto-commitable changes (see syncNewFiles option).
4. perform auto-commit
5. one more check for leftover changes / general tidyness
6. fetch upstream
@@ -58,7 +62,7 @@ The flow is roughly:
On the first invocation, `git-sync` will ask you to whitelist the
current branch for sync using git config. This has to be done once for
-every copy.
+every repository (and branch, for completeness).
## Options
@@ -66,8 +70,10 @@ There are two `git config`-based options for tailoring your sync:
branch.$branch_name.syncNewFiles (bool)
-Tells git-sync to invoke auto-commit even if new (untracked)
-files are present. Normally you have to commit those yourself.
+Tells git-sync to invoke auto-commit even if new (untracked) files are
+present. Normally you have to commit those yourself to prevent
+accidential additions. git-sync will exit at stage 3 with an
+explanation in that case.
branch.$branch_name.autocommitscript (string)
@@ -76,7 +82,7 @@ auto-commit. Here you can run a commit script which should not
leave any uncommited state. The default will commit modified or
all files with a more or less useful message.
-By default commit is done using:
+By default, commit is done using:
git add -u ; git commit -m "changes from $(uname -n) on $(date)"
View
20 git-sync
@@ -157,7 +157,7 @@ exit_assuming_sync() {
exit 0;
else
echo "git-sync: Synchronization FAILED! You should definitely check your repository carefully!"
- echo "(Possibly, a concurrent push to $remote_name screwed it?)"
+ echo "(Possibly a transient network problem? Try gain in that case.)"
exit 3
fi
}
@@ -174,7 +174,7 @@ elif [[ "NOGIT" = "$rstate" ]] ; then
echo "git-sync: No git repository detected. Exiting."
exit 128 # matches git's error code
else
- echo "git-sync: git repo state considered unsafe for sync: $(git_repo_state)"
+ echo "git-sync: Git repo state considered unsafe for sync: $(git_repo_state)"
exit 2
fi
@@ -197,7 +197,7 @@ if [ "true" != "$(git config --get --bool branch.$branch_name.sync)" ] ; then
echo
echo "to whitelist branch $branch_name for synchronization."
echo "Branch $branch_name has to have a same-named remote branch"
- echo "for this script to work."
+ echo "for git-sync to work."
echo
echo "(If you don't know what this means, you should change that"
echo "before relying on this script. You have been warned.)"
@@ -208,7 +208,7 @@ fi
# while at it, determine the remote to operate on
remote_name=$(git config --get branch.$branch_name.remote)
-echo "git-sync: using $remote_name/$branch_name"
+echo "git-sync: Using $remote_name/$branch_name"
# check for intentionally unhandled file states
if [ ! -z "$(check_initial_file_state)" ] ; then
@@ -237,17 +237,17 @@ if [ ! -z "$(local_changes)" ]; then
# after autocommit, we should be clean
rstate="$(git_repo_state)"
if [[ ! -z "$rstate" ]]; then
- echo "git-sync: Auto-commit left uncommited changes. Cannot continue."
+ echo "git-sync: Auto-commit left uncommited changes. Please add or remove them as desired and retry."
exit 1
fi
fi
# fetch remote to get to the current sync state
# TODO make fetching/pushing optional
-echo "fetching from $remote_name"
+echo "git-sync: Fetching from $remote_name"
git fetch $remote_name
if [ $? != 0 ] ; then
- echo "git-sync: git fetch $remote_name returned non-zero. Cannot continue."
+ echo "git-sync: git fetch $remote_name returned non-zero. Likely a network problem; exiting."
exit 3
fi
@@ -260,12 +260,12 @@ case "$(sync_state)" in
exit_assuming_sync
;;
"ahead")
- echo "git-sync: Pushing changes"
+ echo "git-sync: Pushing changes..."
git push
if [ $? == 0 ]; then
exit_assuming_sync
else
- echo "git-sync: git push returned non-zero. Possibly a connection failure."
+ echo "git-sync: git push returned non-zero. Likely a connection failure."
exit 3
fi
;;
@@ -288,7 +288,7 @@ case "$(sync_state)" in
git push
exit_assuming_sync
else
- echo "git-sync: Rebasing failed, likely there are conflicting changes."
+ echo "git-sync: Rebasing failed, likely there are conflicting changes. Resolve them and finish the rebase before repeating git-sync."
exit 1
fi
# TODO: save master, if rebasing fails, make a branch of old master
Please sign in to comment.
Something went wrong with that request. Please try again.