LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Git - create patch after local commit (https://www.linuxquestions.org/questions/linux-software-2/git-create-patch-after-local-commit-823297/)

student04 07-31-2010 06:27 PM

Git - create patch after local commit
 
I must have not read through the tutorial first.. I made changes to a project managed with git. A local copy of the repository exists on my machine (as is supposed to be with git). No branch was created for my additions. I've been committing changes to my local repository and doing pulls/merges with the remote repository. I do not have permissions to push changes to the remote repository forcing me to create a patch to email to someone who does.

Code:

$ git status
# On branch devel
# Your branch is ahead of 'origin/devel' by 6 commits.
<snip>

No tracked files are now modified. I cannot figure out how to create a patch that reflects changes between the remote repository and the commits of my repository. All tutorials I've read online state that you make a patch before committing to local. Is there a way to do this with git? Or must I download a separate copy and manually perform a diff?

vonbrand 08-04-2010 04:21 PM

You can just say:

git diff origin/devel..devel

In any case, I'd advise you create a branch for your work, e.g.

git checkout devel # Make sure we are on the 'devel' branch's tip
git checkout -b mybranch # Create a new branch there
git branch -d devel # Get rid of old 'devel'
git checkout -b devel origin/devel # Recreate 'devel' tracking the original site

Go look for Git Magic

shogun1234 10-11-2010 01:04 PM

Quote:

Originally Posted by vonbrand (Post 4056005)
You can just say:

git diff origin/devel..devel

In any case, I'd advise you create a branch for your work, e.g.

git checkout devel # Make sure we are on the 'devel' branch's tip
git checkout -b mybranch # Create a new branch there
git branch -d devel # Get rid of old 'devel'
git checkout -b devel origin/devel # Recreate 'devel' tracking the original site

Go look for Git Magic

If I want to submit a patch to a remote project e.g. abc. I do not have permission to commit to the remote repos. Is the following the right way to submit the patch?

1. git clone http://domain.com/porject/abc.git #This would create abc folder
2. cd abc
3. git checkout -b abc
4. # then modify source
5. git commit
6. git format-patch #which would create a file named e.g. 0001.something.patch

Then I send the .patch file to the admin of remote repos.
Is this correct?

I appreciate any advice.

Thank you.


All times are GMT -5. The time now is 06:38 AM.