I know this may sound crazy but I think it will work.. We have to report quick wins each week to the manger so what I was thinking is that we can use git to do the logging and then the manager can just pull the pass 7 days of the log.
so I create a git repo with the following command
mkdir mynotes.git
cd mynotes.git
git init
I then create this script in it:
#!/bin/sh
clear
echo "Quick Logging (Press Enter on a blank line to exit)"
while true
do
echo
read -p "log> " logtext
if test -z "$logtext"
then
exit 0
else
git commit --allow-empty -m "$logtext"
fi
done
So then each much of the team can do a git pull and push to the repo.. The issue that I am having is that if someone pushed to the repo as someone else is logging and then trys to push we get this error.
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@git.xxxx.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
How can we make this system work.. it sounds like something great if we can get it working
Although the reason you are getting an error is a duplicate of this question , let me give you more details because it seems you are mixing up workflow with reporting...
So then each much of the team can do a git pull and push to the repo
Assuming that you are doing the above step like you described, your pull most likely failed due to a conflict. You must resolve your conflict to finish the merge before pushing your changes. Do a git status
to see conflicted files, modify them, git add
them to stage them, then commit and push.
I would recommend another approach. Manage the merges in your development workflow, and do your 7-day reporting seperately. The git log
command has a nice option for that:
git log --since="7 days ago"
Check the manual of the git log
command because it has tons of other useful formatting options.
git log --since="7 days ago" --pretty=format:"%ad|%h|%cn|%s"
You could use that git log command on a dedicated local repository which only pulls from your remote right before you want to print the 7-day log, or redirect it to a file or another script.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.