diff --git a/tildewiki/git_wrapper.py b/tildewiki/git_wrapper.py index 84090fb..0bbe9a7 100644 --- a/tildewiki/git_wrapper.py +++ b/tildewiki/git_wrapper.py @@ -26,15 +26,16 @@ def make_commit(repo_path, author_name, author_email): return repo = gitpython.Repo(repo_path) index = repo.index - - index.add([path for (path, _), __ in index.entries.items()]) + repo.git.add(['--all']) actor = gitpython.Actor(author_name, author_email) index.commit('wiki update', author=actor, committer=actor) -def push_all(repo_path): - repo = gitpython.Repo(repo_path) - repo.remotes['origin'].push() +def push_hard(local_repo_path, remote_repo_path): + local_repo = gitpython.Repo(local_repo_path) + local_repo.remotes['origin'].push() + remote = gitpython.Repo(remote_repo_path) + remote.git.reset(['--hard', 'HEAD']) def pull_from_origin(repo_path): repo = gitpython.Repo(repo_path) diff --git a/tildewiki/main.py b/tildewiki/main.py index b84c88d..edb4665 100644 --- a/tildewiki/main.py +++ b/tildewiki/main.py @@ -137,7 +137,7 @@ def publish(config, local_repo_path): git.pull_from_origin(local_repo_path) click.echo('Pushing your changes...') - git.push_all(local_repo_path) + git.push_hard(local_repo_path, config.repo_path) click.echo('Compiling wiki to {}'.format(config.publish_path)) click.confirm(WIPE_PROMPT.format(config.publish_path), abort=True)