Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: Push to a remote repository with a message

Tags:

git

message

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?

like image 447
PruitIgoe Avatar asked May 09 '12 18:05

PruitIgoe


People also ask

How do I push changes to a git repository?

To push changes from the current branch press Ctrl+Shift+K or choose Git | Push from the main menu. To push changes from any local branch that has a remote, select this branch in the Branches popup and choose Push from the list of actions.

How do you commit to a message?

To add a Git commit message to your commit, you will use the git commit command followed by the -m flag and then your message in quotes. Adding a Git commit message should look something like this: git commit -m “Add an anchor for the trial end sectionnn.”

How to push commits to a remote repository in Git?

Pushing commits to a remote repository 1 Renaming branches. To rename a branch, you'd use the same git push command, but you would add one more argument: the name of the new branch. 2 Dealing with "non-fast-forward" errors. ... 3 Pushing tags. ... 4 Deleting a remote branch or tag. ... 5 Remotes and forks. ... 6 Further reading

How do I push a branch to remote in Git?

Push Branch To Remote. In order to push a Git branch to remote, you need to execute the “ git push ” command and specify the remote as well as the branch name to be pushed. $ git push <remote> <branch>. For example, if you need to push a branch named “ feature ” to the “origin” remote, you would execute the following query.

How do I push a branch from one repository to another?

In order to push a branch to another repository, you need to execute the “git push” command, and specify the correct remote name as well as the branch to be pushed. $ git push <remote> <branch>. In order to see the remotes defined in your repository, you have to execute the “git remote” command with the “-v” option for “verbose”.

How do I pull changes from a local Git repository?

If you want to collaborate with the original repository, you'd add a new remote URL, typically called upstream, to your local Git clone: Now, you can fetch updates and branches from their fork: When you're done making local changes, you can push your local branch to GitHub and initiate a pull request.


2 Answers

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.

like image 54
manojlds Avatar answered Sep 21 '22 01:09

manojlds


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.

like image 24
Sundar Avatar answered Sep 19 '22 01:09

Sundar