Created
February 13, 2013 07:32
-
-
Save rusllonrails/4942901 to your computer and use it in GitHub Desktop.
GIT useful commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GIT guide | |
1.) gitconfig | |
cd | |
.gitconfig | |
nano .gitconfig | |
2.) внутрь .gitconfig | |
[user] | |
name = your name | |
email = your email | |
[alias] | |
st = status | |
ci = commit | |
br = branch | |
co = checkout | |
df = diff | |
lg = log -p | |
[color] | |
branch = auto | |
diff = auto | |
status = auto | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green | |
[color "diff"] | |
meta = yellow bold | |
frag = magenta bold | |
old = red bold | |
new = green bold | |
[color "status"] | |
added = yellow | |
changed = green | |
untracked = cyan | |
3.) Добавление | |
git add . (добавляет всех, кроме удален ных) | |
git add path_to_your_file (добавляет один файл) | |
4.) Посмотреть историю коммитов | |
git log | |
5.) Посмотреть изменения, сделанные в коммите | |
git show hash_commit | |
6.) Посмотреть кто и что менял или добавлял в файле | |
git blame path_to_your_file | |
7.) Посмотреть текущую и остальные ветки, на локальной тачке | |
git branch | |
8.) Посмотреть все ветки в удаленных репозиториях (тока залитые) | |
git branch -a | |
9.) Вытащить инфу о всех ветках на удаленных репозиториях | |
git fetch origin_name (вытащит всю инфу о ветках заданного репо) | |
10.) Мерже коммитов | |
git merge | |
11.) Просмотр изменений всех не закомиченных файлов | |
git diff | |
12.) Просмотр изменений незакомиченных сделанных в конкретном файле | |
git diff path_to_your_file | |
13.) Фиксирование удаленных файлов (. - всех, или одного path_to_file) | |
git rm path_to_your_file | |
14.) Создание коммита | |
git commit -m "My commit" (создание коммита с сообщением и только зафиксированных файлов) | |
git commit -a -m "My commit" (создание коммита по всем изменениям, даже тем которые не добавлены с помощью git add / git rm, и кроме новых незатреканных файлов) | |
15.) Заливаем на сервак | |
git push origin_name branch_name (origin_name - имя репозитория (origin, heroku итд), branch_name - название ветки) | |
16.) Добавление дополнительных репозиториев | |
git remote add origin_name ssh_git_path | |
17.) Просмотр всех удаленных репо | |
git remote -v | |
18.) Выдирание коммита из одной ветки в другую | |
git cherry-pick commit_hash |
git br
git fetch origin
git br -a
git co -b name origin/name
git pull origin name
git co master
git pull origin master
git merge name
conflict
git add .
git ci -am "merge"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
git reset - сбросить весь индекс
git rm -r --cached folder_name - удалить папку folder_name из удаленного репозитория