Setup GitHub
sudo apt-get install git-core
git config --global user.name "NewUser"
git config --global user.email you@email.com
~/.gitconfig - global config
git config --global user.name "NewUser"
git config --global user.email you@email.com
~/.gitconfig - global config
--------------------------------------------------------------
[user]name = *** ****
email = ****@gmail.com
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
[core]
excludesfile = /home/pro/.gitignore_global
git config --global --unset core.excludesfile
And of course you can simply edit the config file:
git config --global --edit
git config --global core.excludesfile ~/.gitignore_global
git config --global --unset core.excludesfile ~/.gitignore_global
--------------------------------------------------------------
удалить файли из под git
что бы убрать из гит файл config/databases.yml
нужно сделать, когда он будет "красным":
1. git reset config/databases.yml
2. git rm --cached config/databases.yml
что бы убрать из гит файл config/databases.yml
нужно сделать, когда он будет "красным":
1. git reset config/databases.yml
2. git rm --cached config/databases.yml
echo "# rep_name" >> README.md
git init
nano .gitignore (vendor)
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/username/repositoryname.git
git push -u origin master
git checkout -b name-branch
git branch
----------------------------------------------------
Tag
git tag v1
git git checkout v1^ - переключиться на предыдущий коммит
git tag v1-beta
git checkout v1
git checkout v1-beta
git tag
v1
v1-beta
git hist master --all
-----------------------------------------------------
отмена (add)
git reset HEAD hello.html (HEAD, hesh, branch, tag)
git checkout hello.html
git status
------------------------------------------------------
отмена commit в локальный репак
git revert HEAD или git revert HEAD <hash>
без открытия редактора
git revert HEAD --no-edit
git tag oops
git reset --hard v1
* 9d5f06c 2017-09-26 | Revert "Oops, we didn't want this commit" (HEAD -> master) [primemix]
* 4400918 2017-09-26 | Oops, we didn't want this commit [primemix]
* e23b066 2017-09-26 | Added HTML header (tag: v1) [primemix]
* dff030b 2017-09-26 | Added standard HTML page tag (tag: v1-beta) [primemix]
* e3a5a89 2017-09-26 | "Addes h1 tag" [primemix]
* a82b1cb 2017-09-26 | First commit [primemix]
* e23b066 2017-09-26 | Added HTML header (HEAD -> master, tag: v1) [primemix]
* dff030b 2017-09-26 | Added standard HTML page tag (tag: v1-beta) [primemix]
* e3a5a89 2017-09-26 | "Addes h1 tag" [primemix]
* a82b1cb 2017-09-26 | First commit [primemix]
удаление commit
git tag -d oops <- delete
git hist --all
----------------------------------------------------
Внести изменения в коммит
git add hello.html
git commit -m "Add an Author comment"
ой забыл добавить емайл
git add hello.html
git commit --amend -m "Add an Author/email comment"
git hist
---------------------------------------------------
Подтянуть и смержить измениния из удаленного репака c локальным
git pull
эквивалентно:
git fetch
git merge origin/master
origin - remote
merge dev (local)
Подтянуть и смержить измениния из удаленного репака c локальным
git pull
эквивалентно:
git fetch
git merge origin/master
origin - remote
merge dev (local)
Changing a remote's URL
git remote -v
origin git@github.com:USERNAME/REPOSITORY.git (fetch)
origin git@github.com:USERNAME/REPOSITORY.git (push)
-
Change your remote's URL from SSH to HTTPS with the
git remote set-url command.
git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git
Комментариев нет:
Отправить комментарий