Git: Push to a remote repository with a message

断了今生、忘了曾经 提交于 2019-12-06 16:55:35

问题


My company is incorporating iRise for prototyping and it lacks any kind of versioning (unless making copies of your files with different file names = versioning). Anyway, we're using Git for our version control and since the typical iRise user here will be a graphic/web designer I want to automate the process as much as possible. I have a hot folder running an AppleScript that will push to a remote repository but I'm not sure how to add a message...

git push TestProject master 

tried

git push TestProject master -m 'message'

but threw a switch error and showed a list of options, -m not being one of them...

is this possible or do you have to commit locally first and then push that to the remote and the message will be attached with it?


回答1:


You will have to do a commit ( after adding files)

git commit -m 'message'

and then push:

git push TestProject master

You cannot associate a message to the push.




回答2:


I think the question is legitimate, and is not completely answered by the answer above. Here is a workflow we use at our company (we use git flow):

  1. git flow feature start myFeature
  2. git commit -m 'commit for feature myFeature prior to code review'
  3. initiate code collaborator review with the commit above.
  4. git commit -m 'commit for code review comments/changes for myFeature round1'
  5. <same as above, maybe round2>
  6. git flow feature finish myFeature
    • this merges to local develop branch, and deletes myFeature branch
  7. git push origin develop

Now it would be real nice if we could add a message like this during the push Step 7. like this:

git push -m 'Feature is code complete, code collaborator review ids 1234, 1235.' origin develop

Definitely, not a trivial case where someone is trying to push without commits, but a very useful step where you are annotating a specific push with metadata that provides some audit trail.



来源:https://stackoverflow.com/questions/10521628/git-push-to-a-remote-repository-with-a-message

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!