Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Tuesday, January 01, 2019

transfer github repo and change committers email



mixture of these:
  • https://help.github.com/articles/importing-a-git-repository-using-the-command-line/
  • https://help.github.com/articles/changing-author-info/#platform-linux/
1. clone the old repo with bare git clone --bare https://external-host.com/extuser/repo.git foo cd foo 2. use this github script https://help.github.com/articles/changing-author-info/#platform-linux and change the variables 3. create a new github repo 4. push to the new repo git push --mirror https://github.com/ghuser/repo.git

Thursday, November 08, 2018

Cache GIT password for some time


# Set git to use the credential memory cache
git config --global credential.helper cache

# Set the cache to timeout after 1 hour (setting is in seconds)
git config --global credential.helper 'cache --timeout=3600'

Thursday, October 25, 2018

check git project status (only first level)


#!/bin/sh                                                                                                                                                                     

clear
for d in `find . -name .git | sed -e 's|^./||' -e 's|/.git$||' | grep -v '/'`; do
    echo
    cd $d
    echo "================================================="
    pwd
    git pull
    git st
    cd -
done


Sunday, September 17, 2017

change git user and email for previous commits


git filter-branch --commit-filter \
  'if [ "$GIT_AUTHOR_NAME" = "OLD-NAME" ]; then \                                                                                                 
      export GIT_AUTHOR_NAME="NEW-NAME";\                                                                                                               
      export GIT_AUTHOR_EMAIL=NEW-EMAIL;\                                                                                                        
      export GIT_COMMITTER_NAME="NEW-NAME";\                                                                                                            
      export GIT_COMMITTER_EMAIL=NEW-EMAIL;\                                                                                                     
  fi;\                                                                                                                                              
git commit-tree "$@"'

set git user and email for a repository


git config user.name "NEW-NAME"; git config user.email "info@..."

Monday, January 27, 2014

Monday, January 20, 2014

git cheetsheet

git config --global alias.st status
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.di diff
git config --global alias.br branch

git config --global color.diff never

sample:

git co -b newbr
emacs ...
git ci -am ...
git co master
git merge newbr
git br -d newbr

git checkout                # switch to branch
git checkout -b             # create new topic branch (and switch)

git branch -a                            # list all branches (local+remote)

git checkout master
git merge                   # merge other into master

git branch -d               # delete local branch
git push origin --delete    # delete remote branch
git diff master..staging                 # diff two branches
git diff --name-status master..staging   # show diffing files

git log --graph --decorate --oneline
git log --graph --full-history --all --pretty=format:"%h%x09%d%x20%s"
git diff ignores owner/group
#repository local:
git config core.filemode false
more infos here: https://www.kernel.org/pub/software/scm/git/docs/git-config.html