recentpopularlog in

kme : git   490

« earlier  
Git Aliases I Use (Because I'm Lazy) -
s = status
d = diff
co = checkout
br = branch
last = log -1 HEAD
cane = commit --amend --no-edit
lo = log --oneline -n 10
pr = pull --rebase
git  alias  shortcuts  productivity  commandline  devel 
5 days ago by kme
How do I clone a gist using https:// instead of git:// - Stack Overflow
This probably isn't an issue anymore for GitHub gists, but this was the solution to using 'url."https://something".insteadof https://somethingelse', which I was looking for.

See also:
You can configure git to use https:// globally by running running
<code class="language-bash">git config --global url."https://".insteadOf git://</code>
or by adding the following to ~/.gitconfig:
<code class="language-ini">[url "https://"]
insteadOf = git://
git  github  gitfu  insteadof  cloneurl  solution 
7 days ago by kme
scripting - How to parse and convert ini file into bash array variables? - Server Fault
<code class="language-bash">eval $(git config -f mytool.ini --list | tr . _)</code>
bash  associativearray  configfile  ini  parsing  git  gitconfig  solution 
23 days ago by kme
How do I make Git ignore file mode (chmod) changes? - Stack Overflow
<code class="language-bash">git config core.fileMode false
git  mode  chmod  annoyance  solution 
23 days ago by kme
brammool/libvterm: Mirror of
<code>To merge in changes from Github, do this:
- Commit any pending changes.
- Setup the merge tool:
git config merge.tool vimdiff
git config merge.conflictstyle diff3
git config mergetool.prompt false
- Run the merge tool:
git mergetool
This will open a four-way diff between:
LOCAL - your current version
BASE - version as it was at your last sync
REMOTE - version at head on Github
MERGED - best-effort merge of LOCAL and REMOTE
Now find places where automatic merge didn't work, they are marked with
<<<<<<<<, ======= and >>>>>>>
Fix those places in MERGED, remove the markers, and save the file :wqall.</code>
vim  devel  git  vimdiff  merging  merge  mergetool  tipsandtricks 
25 days ago by kme
List commits between 2 commit hashes in git - Stack Overflow
I ended up using
<code class="language-bash">git log -L 150,180:builtins/shopt.def bash-4.1.11..bash-4.3</code>
to solve the problem I was having (which version of Bash introduced the 'direxpand' option to 'shopt'; hint: 4.2.29)

See also:
devel  git  commit  history  automation  forensics  sortof  solution 
7 weeks ago by kme
git - Why should I care about lightweight vs. annotated tags? - Stack Overflow
@Chris yes, as the answer says, "The big plus of an annotated tag is that you know who created it." You can always try things yourself to find out: git tag -a -m 'my message' my-tag; git show my-tag – Cascabel Aug 9 '17 at 16:17

Note, though, that '-a' is implied when '-m' is given.
git  tags  annotatedtags  thisvsthat  lightweighttags  release  solution 
june 2019 by kme
aanand/git-up: NOT MAINTAINED
git pull has two problems:

* It merges upstream changes by default, when it's really more polite to rebase over them, unless your collaborators enjoy a commit graph that looks like bedhead.

* It only updates the branch you're currently on, which means git push will shout at you for being behind on branches you don't particularly care about right now.
git  helperscript  devel  workflow  ruby  rubygem 
june 2019 by kme
git_semver · PyPI
Simple usage
<code class="language-bash">git semver
# 0.1.0

git semver --next-patch
# 0.1.1

git semver --next-minor
# 0.2.0

git semver --next-major
devel  git  semver  versioning  packaging  release  utility  python  helperscript 
june 2019 by kme
debugging - How can I debug git/git-shell related problems? - Stack Overflow
<code class="language-bash">GIT_CURL_VERBOSE=1 GIT_TRACE=1 git pull origin master</code>
git  curl  debugging  https  troubleshooting  annoyance 
june 2019 by kme
Using R with git and packrat - Stack Overflow
packrat::init(".") actually appends to your .gitignore nowadays.
r  dependencymanagement  packagemangement  packrat  git  gitignore  solution 
may 2019 by kme
Merge requests | GitLab
Interesting tip on how to make an alias accept arguments:
<code class="language-bash">[alias]
mr = !sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -
git  gitlab  versioncontrol  scm  vcs  mergerequest  merging  devel  reference 
april 2019 by kme
How can I set up an editor to work with Git on Windows? - Stack Overflow |
Git for Windows uses 'nano.exe' for this setting, forcing you to override it if you want to use, say, Vim. It does not seem to respect the EDITOR environment variable.
By configuring git config core.editor notepad, users can now use notepad.exe as their default editor.

Configuring git config format.commitMessageColumns 72 will be picked up by the notepad wrapper and line-wrap the commit
message after the user edits it.
git  gitconfig  commitmessage  windows  newbie  annoyance  solution 
march 2019 by kme
How effectively delete a git submodule. |
To remove a submodule you need to:

* Delete the relevant section from the .gitmodules file.
* Stage the .gitmodules changes git add .gitmodules
* Delete the relevant section from .git/config.
* Run git rm --cached path_to_submodule (no trailing slash).
* Run rm -rf .git/modules/path_to_submodule (no trailing slash).
* Commit git commit -m "Removed submodule "
* Delete the now untracked submodule files rm -rf path_to_submodule
git  submodule  dammitbrain  solution 
march 2019 by kme
git - .gitignore exclude folder but include specific subfolder - Stack Overflow |
To do what you want, you have to “unignore” every parent directory of anything that you want to “unignore”. Usually you end up writing rules for this situation in pairs: ignore everything in a directory, but not some certain subdirectory.
<code class="language-gitignore"># you can skip this first one if it is not already excluded by prior patterns


git  gitignore  devel  annoyance  dammitbrain  solution 
march 2019 by kme
man command not found on git bash · Issue #249 · swcarpentry/shell-novice |
man doesn't seem to be installed on git bash - learners get a "man: command not found" error when they try to use it.
softwarecarpentry  git  gitforwindows  bash  annoyance  packagemanagement  workaround  solution 
february 2019 by kme
Man pages for Git Bash on Windows 7 - Super User |
Yeah, if you want man pages by default, it's actually more prudent to do a default install of Cygwin.

You /could/ install Python, then 'pip install tldr', but that's not a good solution for a workshop.
windows  bash  git  shell  unix  workshop  howto 
february 2019 by kme
StackExchange/blackbox: Safely store secrets in Git/Mercurial/Subversion |
Safely store secrets in Git/Mercurial/Subversion. Contribute to StackExchange/blackbox development by creating an account on GitHub.
secrets  devel  git  security  crypto  encryption  puppet  collaboration 
february 2019 by kme
bup/bup: Very efficient backup system based on the git packfile format, providing fast incremental saves and global deduplication (among and within files, including virtual machine images). Current release is 0.29.2, and the development branch is master.
Very efficient backup system based on the git packfile format, providing fast incremental saves and global deduplication (among and within files, including virtual machine images). Current release is 0.29.2, and the development branch is master. Please post problems or patches to the mailing list for discussion (see the end of the README below). - bup/bup
git  backup  packfile  backupandrecovery  utility  commandline  alternativeto  duplicity 
february 2019 by kme
jiahaog/gitcloud: Use GitHub for file hosting and indexing |
Use GitHub for file hosting and indexing. Contribute to jiahaog/gitcloud development by creating an account on GitHub.
git  github  hosting  cloudstorage 
january 2019 by kme
Git - Rebasing |
If you're not already checked out to the "topic" branch, you can do that this way
<code class="language-bash">
git rebase master topic-branch

Just remember that the first argument is always the "onto" (base) branch.
For this example, you would check out the experiment branch, and then rebase it onto the master branch as follows:
<code class="language-bash">
git checkout experiment
git rebase master
# First, rewinding head to replay your work on top of it...
# Applying: added staged command

This operation works by going to the common ancestor of the two branches (the one you’re on and the one you’re rebasing onto), getting the diff introduced by each commit of the branch you’re on, saving those diffs to temporary files, resetting the current branch to the same commit as the branch you are rebasing onto, and finally applying each change in turn.

At this point, you can go back to the master branch and do a fast-forward merge.
<code class="language-bash">
git checkout master
git merge experiment

There is no difference in the end product of the integration, but rebasing makes for a cleaner history. If you examine the log of a rebased branch, it looks like a linear history: it appears that all the work happened in series, even when it originally happened in parallel.
git  rebase  vcs  versioncontrol  reference  newbie  dammitbrain 
december 2018 by kme
SSH keys - Atlassian Documentation |
SHA256 format

2048 SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A (RSA)
1024 SHA256:RezPkAnH1sowiJM0NQXH90IohWdzHc3fAisEp7L3O3o (DSA)

md5 format

97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40 (RSA)
35:ee:d7:b8:ef:d7:79:e2:c6:43:9e:ab:40:6f:50:74 (DSA)
ssh  publickeyauthentication  bitbucket  git  hostkeyverification  fingerprints  solution 
november 2018 by kme
How to change the remote repository for a git submodule? - Stack Overflow |
You should just be able to edit the .gitmodules file to update the URL and then run git submodule sync to reflect that change to the superproject and your working copy.

Also handy (like 'git remote -v', sort of):
<code class="language-bash">git submodule foreach -q git config remote.origin.url</code>
git  scm  versioncontrol  submodule  solution  dammitbrain 
june 2018 by kme
Testing your SSH connection - User Documentation []
<code>The authenticity of host ' (IP ADDRESS)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?

<code>The authenticity of host ' (IP ADDRESS)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?
git  github  ssh  hostkey  fingerprint  security  reference 
march 2018 by kme
python - pip install from git repo branch - Stack Overflow |

Prepend the url prefix git+ (See VCS Support):
<code class="language-bash">pip install git+</code>

And specify the branch name without the leading /.
python  pip  packagemanagement  sysadmin  deployment  git  solution 
march 2018 by kme
clone - git: fatal: I don't handle protocol '​​http' - Stack Overflow
This is EXACTLY what I did:
This happened to me using msys-git and trying to paste (with ctrl-v and ctrl-shift-v), before realizing they were not valid keyboard shortcuts. Redoing the command and pasting with right-click->paste seemed to work. – Darthfett Apr 5 '16 at 17:58
windows  copypaste  git  errormessage  solution  cygwin  nonprinting 
january 2018 by kme
A Helpful Mnemonic for 'git rebase' Arguments // Think Like (a) Git
This is helpful:
So when I use git rebase, I (almost) always give it two arguments: the name of the place I want to start from, and the name of the place I want to end up. Or, to put it another way, I tell rebase the sequence of events I want it to create, from left to right: git rebase first_this then_this

But this section of the 'git-rebase' manual page is equally helpful:
Assume the following history exists and the current branch is "topic":

A---B---C topic
D---E---F---G master

From this point, the result of either of the following commands:

git rebase master
git rebase master topic

would be:

A'--B'--C' topic
D---E---F---G master
git  rebase  git-rebase  mnemonic  dammitbrain  reference  newbie 
december 2017 by kme
Git - git-ls-tree Documentation |
You can use this on a commit hash to get the files, then <code>git cat-file -p <hash></code> or <code>git cat-file blob <hash></code> to get the contents of a file at a specific commit.

The easier way might be <code>git show <tree-ish></code> as mentioned explained at
git  workaround  sortof  solution 
november 2017 by kme
Git: what they didn’t tell you | Steve Bennett blogs |
Don’t call any remote ‘origin’

You will never understand “git reset”‘s options

The difference between “git reset”, “git reset –soft” and “git reset –hard” is beyond your comprehension. And you probably wanted “git checkout” anyway.

Rule of thumb:

If your directory is FUBAR: git reset –hard
If you just want to throw away changes to one file: git checkout file
In all other cases, google it.
git  scm  newbie  annoyance  gotcha  advice  bestpractices 
november 2017 by kme
10 things I hate about Git | Steve Bennett blogs |
7. Unsafe version control

The fundamental promise of any version control system is this: “Once you put your precious source code in here, it’s safe. You can make any changes you like, and you can always get it back”. Git breaks this promise. Several ways a committer can irrevocably destroy the contents of a repository:

git add . / … / git push -f origin master
git push origin +master
git rebase -i <some commit that has already been pushed and worked from> / git push

A few bonus command inconsistencies:


To reset one file in your working directory to its committed state:

git checkout file.txt

To reset every file in your working directory to its committed state:

git reset --hard

Remotes and branches

git checkout remotename/branchname
git pull remotename branchname

There’s another command where the separator is remotename:branchname, but I don’t recall right now.
git  versioncontrol  scm  critque  annoyances 
november 2017 by kme
Pagure: DIY git project hosting - Fedora Magazine |
Pagure is a new, full featured git repository service for the web, written in Python. It is similar to other popular git forges like Github and Gitlab, allowing open source contributors to share and collaborate on code and content. By the way, pagure is French for “hermit crab,” as reflected in the logo on the project documentation.
git  scm  fedorahosted  hosting  fedora  alternativeto  gitlab  github 
october 2017 by kme
How can I check in a bash script if my local git repo has changes - Stack Overflow |
<code class="language-bash">
cd /git/directory
if [[ `git status --porcelain` ]]; then
# changes
# no changes

This would be OK, but doesn't pick up untracked (newly-added) files:

<code class="language-bash">
git diff --no-ext-diff --quiet --exit-code
git  versioncontrol  scm  shellscripting  solution 
september 2017 by kme
« earlier      
per page:    204080120160

Copy this bookmark:

to read