Git: Difference between revisions

From Wiki
No edit summary
Line 66: Line 66:
<pre>
<pre>
inotifywait -q -m -e CLOSE_WRITE --format="git commit -a -m 'autocommit on change' %w" file.txt | sh
inotifywait -q -m -e CLOSE_WRITE --format="git commit -a -m 'autocommit on change' %w" file.txt | sh
 
</pre>
or  
</blockquote>
 
::or  
<blockquote>
<pre>
while true; do
while true; do
   inotifywait -qq -e CLOSE_WRITE ~/.calendar/calendar
   inotifywait -qq -e CLOSE_WRITE ~/.calendar/calendar
   cd ~/.calendar; git commit -a -m 'autocommit on change'
   cd ~/.calendar; git commit -a -m 'autocommit on change'
done
done
# inotify "-r"  for recursive
# inotify "-r"  for recursive
 
</pre>
or  
</blockquote>
 
::or  
<blockquote>
<pre>
etckeeper
etckeeper
</pre>
</pre>
</blockquote>
</blockquote>

Revision as of 23:32, 9 February 2018

Usage

  • Create repository (on server)
git init
  • show changed files
git diff --cached --name-only
git diff --name-status
  • add files
git add *
  • commit changes
git commit -m "Commit-Nachricht"
git commit -a                      # includes add
  • send changes to server
git push


  • get repository from server
git clone remoteurl


  • get latest changes from server
git pull


Configuration

Special features

  • auto-commit when file changes
inotifywait -q -m -e CLOSE_WRITE --format="git commit -a -m 'autocommit on change' %w" file.txt | sh
or
while true; do
  inotifywait -qq -e CLOSE_WRITE ~/.calendar/calendar
  cd ~/.calendar; git commit -a -m 'autocommit on change'
done
# inotify "-r"  for recursive
or
etckeeper