git

Git - create Patch

general step to generate patch without commit at last

  1. commit your local changes using

    git commit -a -m "specific message"
    

    Note : don't push this commit.

  2. generate patch

    git format-patch -s -n -1 HEAD   
    

    it will generate 0001-.patch

  3. revert back local commit

    to delete commit but keep your work: git reset --soft HEAD~1

    to delete commit with your work: git reset --hard HEAD~1

     

Git - New Repository

  1. SSH into the Dev server
  2. change dir to /srv/git
  3. mkdir repo-name.git
  4. cd repo-name.git
  5. git --bare init  
    That's 2 dashes there before bare Initializes a bare repository One of the cardinal rules of using git is that you should never push to a non-bare repository, as git's object database becomes out of sync and confused by the working copy.
  6. touch git-daemon-export-ok
    tell git daemon that it is meant to be public - this allows public usage from make files.

Git config commands

identifying yourself to Git (globally - for all projects)

 
git config --global user.name "John Smith"
git config --global user.email "john.smith@example.com"
 
 
To identify yourself differently to just one project:
 
git config --local user.name "Joe Smith"
git config --local user.email "joe.smith@example.com"
 
Subscribe to RSS - git