Git

Git: /.git/hooks/post-commit to push to origin repo on commit

Some applications - such as gitg - make available LOCAL commits & branch management, but have no provision for PUSHING to the remote origin.

Luckly, git leverages 'hooks' that provide a means to add shell scripts for such a need.

Once a commit is done on a branch, git will call "/.git/hooks/post-commit" and - if present - will run the contained shell script.


#!/bin/bash

#
# post-commit web hook
#
#git push -u origin develop
git push -u origin ffsync-setup

#
# set this file to executable
#
# chmod 755 post-commit
#

this code block will push the ffsync-setup branch to the remote origin

 

Tags

Git Revert: When your already committed BooBoo Code to repo and need to get HEAD back to HAPPY

silosix@M6500:~/git/cmsauto$ git revert 7b55a41
On branch feature/pom_to_pombase
Your branch is up to date with 'origin/feature/pom_to_pombase'.

nothing to commit, working tree clean
silosix@M6500:~/git/cmsauto$ get reset --hard 7b55a41 && git clean -f

Command 'get' not found, but there are 18 similar ones.

silosix@M6500:~/git/cmsauto$ git reset --hard 7b55a41 && git clean -f
HEAD is now at 7b55a41 file cleanup
silosix@M6500:~/git/cmsauto$ git revert 7b55a41
[feature/pom_to_pombase 088dbb9] Revert "file cleanup"
 1 file changed, 4 insertions(+), 5 deletions(-)
silosix@M6500:~/git/cmsauto$ git push -f
Password for 'https://unityconstruct@bitbucket.org':
Counting objects: 10, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (10/10), 746 bytes | 746.00 KiB/s, done.
Total 10 (delta 4), reused 0 (delta 0)
remote:
remote: Create pull request for feature/pom_to_pombase:
remote:   https://bitbucket.org/unitycon
Tags

Git info command for Git SSL Errors

git config --system --list

 

w:\w\git\behatphpfacebook (feature/webdriver-pom -> origin)
λ git config --system --list
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
Tags

BitBucket: Reverting a commit before a push

Actually, when you use git reset, you should refer to the commit that you are resetting to; so you would want the db0c078 commit, probably.

An easier version would be git reset --hard HEAD^, to reset to the previous commit before the current head; that way you don't have to be copying around commit IDs.

Beware when you do any git reset --hard, as you can lose any uncommitted changes you have. You might want to check git status to make sure your working copy is clean, or that you do want to blow away any changes that are there.

Tags
Subscribe to Git