Tagged: git
the hash code of the first commit
references
git rev-list --parents HEAD | egrep "^[a-f0-9]{40}$"
git rev-list --parents HEAD | tail -1
showing branch name in cygwin prompt
git-prompt.sh
git-prompt.sh 를 받는다.
$ pwd /home/user/bin $ wget https://....
~/.bashrc
~/.bashrc
파일에 다음 내용을 추가한다.
source ~/bin/git-prompt.sh PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]$(__git_ps1 " (%s)")\n\$ '
pull’em all
http://stackoverflow.com/a/40601481/330457
find . -type d -name .git -exec git --git-dir={} --work-tree=$PWD/{}/.. pull \;
윈도 시작할 때 pageant 시작하기
references
Windows 10
Windows+R
키를 누르고shell:startup
을 입력하면 시작 아이템들이 모여있는 창이 열린다.- 마우스 오른쪽 버튼 -> New -> Shortcut 을 실행한다.
"Path\To\pageant.exe" "Path\To\id_rsa.ppk"
를 입력한다.
sharing dot files between computers using git
create a repository
As anyone might know, Bitbucket permits private repositories.
$ git pull git@bitbucket:<username>/dot-files.git
put dot files in it
$ cd dot-files/ $ mv ~/.shuttle.json . $ mkdir .m2 $ cd .m2 $ mv ~/.m2/settings.xml . $ mv ~/.m2/settings-security.xml . $ cd .. $ git add \* $ git commit -m "dot files added" $ git push
link dot files
$ cd ~ $ ln -s /path/to/the/dot-files/.shuttle.json $ cd .m2 $ ln -s /path/to/the/dot-files/.m2/settings.xml $ ln -s /path/to/the/dot-files/.m2/settings-security.xml
maven-release-plugin and git submodules
References
Problem
src/main/java
아래에 특정 폴더가 submodule 로 처리된 프로젝트를 평소와 같이 릴리즈 하였다.
$ git checkout -b release/test $ mvn release:prepare release:perform ... [INFO] Nothing to compile - all classes are up to date ... $
target/checkout
폴더에서 submodule이 init 되지 않은 채 그대로 처리된다.
Solution
위 링크에서 제시된 해결책을 사용하여 해결하였다.
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <inherited>false</inherited> <!-- only execute these in the parent --> <executions> <execution> <id>git submodule update</id> <phase>initialize</phase> <configuration> <executable>git</executable> <arguments> <argument>submodule</argument> <argument>update</argument> <argument>--init</argument> <argument>--recursive</argument> </arguments> </configuration> <goals> <goal>exec</goal> </goals> </execution> </executions> </plugin>
Find all repositories and gc them all
$ find . -name .git -type d -execdir git gc --agggressive \;
How to clone/edit/push a GitHub Gist
We can’t add any collaborators to a GitHub Gist.
clone
We can clone a gist with HTTPS clone URL
with a username provided.
$ git clone https://<username>@gist.github.com/<id>.git Cloning into '<id>'... remote: Counting objects: ..., done. remote: Compressing objects: 100% (.../...), done. remote: Total ... (delta ...), reused ... (delta ...), pack-reused ... Unpacking objects: 100% (.../...), done. Checking connectivity... done. $ cd <id> $ git remote show origin * remote origin Fetch URL: https://<username>@gist.github.com/<id>.git Push URL: https://<username>@gist.github.com/<id>.git HEAD branch: master Remote branch: master tracked Local branch configured for 'git pull': master merges with remote master Local ref configured for 'git push': master pushes to master (local out of date) $
Now we can make changes to our files.
push
And git might ask for your password when we push commits back to the remote.
$ git push Password for 'https://<username>@gist.github.com': <password> Counting objects: ..., done. Delta compression using up to ... threads. Compressing objects: 100% (.../...), done. Writing objects: 100% (.../...), ... bytes | ... bytes/s, done. Total ... (delta ...), reused ... (delta ...) To https://<username>@gist.github.com/<id>.git xxxxxxx..xxxxxxx master -> master $