Github command tips

*Init Github
$ git init
Initialized empty Git repository in ~/djangogirls/.git/
$ git config --global user.name "yourname"
$ git config --global user.emai yourname@mail.com

*Making ignore file -> .ignore

*Status check
$ git status
On branch master
Initial commit
Untracked files:  (use "git add <file>..." to include in what will be committed)
        .gitignore        blog/        manage.py        mysite/
nothing added to commit but untracked files present (use "git add" to track)

*add and commit
$ git add --all . #git add .
$ git commit -m "My Django Girls app, first commit"
 [...] 13 files changed, 200 insertions(+) create mode 100644 .gitignore [...] create mode 100644 mysite/wsgi.py

*Set remote repository
$ git remote add origin https://github.com/MareArts/CVLecture_djangocms.git
$ git push -u origin master

*Command arrangement
Working computer
$ git status
$ git add --all .
$ git status
$ git commit -m "Changed the HTML for the site."
$ git push

Deploy computer
$ git pull

*tip force pull
$git fetch --all
$git reset --hard origin/master
$git reset --hard origin/<branch_name>

*tip to set user/pass don't ask every time
save username / pass
$git config credential.helper store
$git pull

change information
$git config credential.helper store 
$git pull

*tip when .igore file not working
git rm -r --cached .
git add .
git commit -m "fixed untracked files"

*delete git
rm -rf .git

*delete specific file ex) some problem file which can't do push because of over than 100mb.
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch path_more_than_100mb.file' \
--prune-empty --tag-name-filter cat -- --all

git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch checkpoints_/model.ckpt-23000.data-00000-of-00001' \
--prune-empty --tag-name-filter cat -- --all

No comments:

Post a Comment