TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Git-Ready to Deploy? Check for uncommitted and non-pushed changes

30 pointsby oleksalmost 7 years ago

8 comments

tomxoralmost 7 years ago
I wrote a git-tag based cli content deployment tool that does something like this as part of the deploy stage. It&#x27;s intended for use with multiple users with a single remote, so before attempting to deploy anything it does the following to ensure no conflicts and that outdated content is never accidentally deployed:<p><pre><code> - Fetches - Checks the branch you are deploying from hasn&#x27;t diverged from it&#x27;s tracking branch. - Checks whether each path+tree-object combo trying to be deployed has already been tagged. - Checks whether each tree path being deployed is clean. - Finally, if it fails to push new tags it reverts everything to prevent deploys unavailable to everyone else. </code></pre> I built this for a special type of content deployment for the company I work for but I think it&#x27;s only been used internally so far (albeit successfully) - I made the tool as generalised as possible though as the core concept is quite re-usable, but I don&#x27;t think I have described it&#x27;s purpose clearly enough for the rest of the world in the readme:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;LearningScience&#x2F;pegit" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;LearningScience&#x2F;pegit</a>
wereHamsteralmost 7 years ago
Do you know about `git-sh-setup`? As in:<p><pre><code> . &quot;$(git --exec-path)&#x2F;git-sh-setup&quot; require_clean_work_tree &quot;bump&quot; &quot;Please commit or stash them.&quot; </code></pre> <a href="https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-sh-setup" rel="nofollow">https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-sh-setup</a>
评论 #17213999 未加载
TekMolalmost 7 years ago
I&#x27;m confused. How is that different from &#x27;git status&#x27;?
评论 #17213952 未加载
评论 #17213949 未加载
colemickensalmost 7 years ago
`git status --porcelain` and `if git diff-index --quiet HEAD -- ; then ...` might be lighter&#x2F;easier ways (and include non-staged files [as well]).<p>Er, I guess that doesn&#x27;t tell if you if you have un-pushed changes... but if your deployment process allows someone to deploy without pushing, your process is broken. Someone <i>will</i> deploy to Prod and forget to push their config changes, eventually.
kbobalmost 7 years ago
On a somewhat related note, I created check-git a few months ago. It scans a directory tree for unclean git repositories. Maybe someone will find it useful.<p><a href="https:&#x2F;&#x2F;kbob.github.io&#x2F;2016&#x2F;11&#x2F;08&#x2F;check-git" rel="nofollow">https:&#x2F;&#x2F;kbob.github.io&#x2F;2016&#x2F;11&#x2F;08&#x2F;check-git</a>
kinowalmost 7 years ago
Useful. Maven checks that for autpmated deployments. It delegates that part to SCM plugins as far as I know. Wonder if this one does the same as Maven. On mobile, but may check later (tis probably around here <a href="https:&#x2F;&#x2F;github.com&#x2F;apache&#x2F;maven-scm?files=1" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;apache&#x2F;maven-scm?files=1</a>)
wiz21calmost 7 years ago
In my job I&#x27;ve written a small script that compares JIRA entries to what lies into git. This I way I can spot things that were forgotten or put on the wrong branch...
_ZeD_almost 7 years ago
ok, seriously, is &quot;using git push to do a deploy&quot; a thing? WTF?
评论 #17214419 未加载
评论 #17215443 未加载
评论 #17214423 未加载