recentpopularlog in

kme : versioncontrol   171

« earlier  
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' -
</code>
git  gitlab  versioncontrol  scm  vcs  mergerequest  merging  devel  reference 
april 2019 by kme
Git - Rebasing | https://git-scm.com/
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
</code>

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
</code>

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
</code>

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
How to change the remote repository for a git submodule? - Stack Overflow | https://stackoverflow.com/
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
10 things I hate about Git | Steve Bennett blogs | https://stevebennett.me/
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:

Reset/checkout

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
How can I check in a bash script if my local git repo has changes - Stack Overflow | https://stackoverflow.com/
<code class="language-bash">
cd /git/directory
if [[ `git status --porcelain` ]]; then
# changes
else
# no changes
fi
</code>

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
</code>
git  versioncontrol  scm  shellscripting  solution 
september 2017 by kme
Gitblit
Gitblit is an open-source, pure Java stack for managing, viewing, and serving Git repositories.

It's designed primarily as a tool for small workgroups who want to host centralized repositories.
git  hosting  server  java  devops  versioncontrol  alternativeto  gitlab  bitbucket  github  gog 
may 2017 by kme
git rewrite history - Remove refs/original/heads/master from git repo after filter-branch --tree-filter? - Stack Overflow
refs/original/* is there as a backup, in case you mess up your filter-branch. Believe me, it's a really good idea.

Once you've inspected the results, and you're very confident that you have what you want, you can remove the backed up ref:

git update-ref -d refs/original/refs/heads/master
git  solution  filter-branch  scm  versioncontrol 
july 2016 by kme
Edit an incorrect commit message in Git - Stack Overflow
You also can use git filter-branch for that.

git filter-branch -f --msg-filter "sed 's/errror/error/'" $flawed_commit^..HEAD

Use interactive rebase

Another option is to use interactive rebase.
This allow you to edit any message you want to update even if its not the latest message

In order to do a git squash follow those steps:

// X is the number of commits to the last commit you want to be able to edit
git rebase -i HEAD~X


then, if you're ballsy, you can just force-push the new branch to the remote master, and everything's all good again.
git  scm  versioncontrol  rewritinghistory  solution 
july 2016 by kme
version control - Change the author of a commit in Git - Stack Overflow
Github has a public script for that help.github.com/articles/changing-author-info and it works great! – rodowi Jun 25 '12 at 0:57

You could do

git rebase -i -p <some HEAD before all of your bad commits>

Then mark all of your bad commits as "edit" in the rebase file. If you also want to change your first commit, you have to manually add it as first line in the rebase file (follow the format of the other lines). Then, when git asks you to amend each commit, do

git commit --amend --author "New Author Name <email@address.com>"

edit or just close the editor that opens, and then do

git rebase --continue

to continue the rebase.

You could skip opening the editor altogether here by appending --no-edit so that the command will be:

git commit --amend --author "New Author Name <email@address.com>" --no-edit && \
git rebase --continue

Single Commit

As some of the commenters have noted, if you just want to change the most recent commit, the rebase command is not necessary. Just do

git commit --amend --author "New Author Name <email@address.com>"

This will change the author to the name specified, but the committer will be set to your configured user in git config user.name and git config user.email. If you want to set the committer to something you specify, this will set both the author and the committer:

git -c user.name="New Author Name" -c user.email=email@address.com commit --amend --reset-author

Note on Merge Commits

There was a slight flaw in my original response. If there are any merge commits between the current HEAD and your <some HEAD before all your bad commits>, then git rebase will flatten them (and by the way, if you use GitHub pull requests, there are going to be a ton of merge commits in your history). This can very often lead to very different history (as duplicate changes may be "rebased out"), and in the worst case, it can lead to git rebase asking you to resolve difficult merge conflicts (which were likely already resolved in the merge commits). The solution is to use the -p flag to git rebase, which will preserve the merge structure of your history. The manpage for git rebase warns that using -p and -i can lead to issues, but in the BUGS section it says "Editing commits and rewording their commit messages should work fine."

I've added -p to the above command. For the case where you're just changing the most recent commit, this is not an issue.
git  devel  rewriting  history  commitlog  scm  versioncontrol  oops  solution 
july 2016 by kme
Undo a Git merge that hasn't been pushed yet? - Stack Overflow
With git log check which commit is one prior the merge. Then you can reset it using:

git reset --hard commit_sha

There's also another way

git reset --hard HEAD~5

will get you back 5 commits.

As @Velmont suggested below in his answer, in this direct case using:

git reset --hard ORIG_HEAD
git  reset  abortabort  scm  versioncontrol  solution 
june 2016 by kme
How to use vimdiff as the subversion diff tool – t+1 - http://blog.tplus1.com/
#!/bin/sh

# Configure your favorite diff program here.
DIFF="/usr/bin/vimdiff"

# Subversion provides the paths we need as the sixth and seventh
# parameters.
LEFT=${6}
RIGHT=${7}

# Call the diff command (change the following line to make sense for
# you
svn  vim  vimdiff  differ  likegit  solution  devel  scm  versioncontrol 
february 2016 by kme
Update Git submodule to latest commit on origin - Stack Overflow - http://stackoverflow.com/
So you probably need to go into the submodule subDIRECTORY and type 'git pull origin master' to do what you were trying to do.
The git submodule update command actually tells Git that you want your submodules to each check out the commit already specified in the index of the superproject. If you want to update your submodules to the latest commit available from their remote, you will need to do this directly in the submodules.
git  submodule  scm  versioncontrol  solution 
february 2016 by kme
Append directories to ignored list in SVN - Stack Overflow - http://stackoverflow.com/
#! /bin/bash
ignore="foo"
for pathname in "$@"; do
lines="$( svn propget svn:ignore "$pathname" )"
grep -F -x -q "$ignore" - <<< "$lines" ||
svn propset svn:ignore "$lines"$'\n'"$ignore" "$pathname"
done


Also cleverly uses the $'\n' trick for literal metacharacters in the shell. The propset actually doesn't work without this trick.
svn  versioncontrol  scm  solution  ignore 
february 2016 by kme
Delete/Remove WebSVN Repos 1 « Knowledge Stack

nano /etc/websvn/svn_deb_conf.inc
and comment out the line

//$config->addRepository("repos 1", "file:///var/svn-repos");
websvn  svn  debian  versioncontrol  webapp  solution 
february 2016 by kme
Examining History
Why Does svn log Not Show Me What I Just Committed?

If you make a commit and immediately type svn log with no arguments, you may notice that your most recent commit doesn't show up in the list of log messages. This is due to a combination of the behavior of svn commit and the default behavior of svn log. First, when you commit changes to the repository, svn bumps only the revision of files (and directories) that it commits, so usually the parent directory remains at the older revision (See the section called “Updates and commits are separate” for an explanation of why). svn log then defaults to fetching the history of the directory at its current revision, and thus you don't see the newly committed changes. The solution here is to either update your working copy or explicitly provide a revision number to svn log by using the --revision (-r) option.
svn  annoyance  versioncontrol  commandline  solution 
february 2016 by kme
svn delete removed files - Stack Overflow
use an

svn status

it will list changes with the working copy. (deleted files start with a ! )

Then, you can :

svn delete file_to_del1 file_to_del2 etc

and finally commit

You can also write a little snippet to automate this:

svn status | grep '^!' | awk '{print $2}' | xargs svn delete
svn  fordummies  newbie  versioncontrol  solution 
february 2016 by kme
svn - How do I ignore files in Subversion? - Stack Overflow
svn propedit svn:ignore .


Note that newly created directories need to be added to version control *first*, then you can modify their properties.
svn  likegit  subversion  versioncontrol  scm  solution 
february 2016 by kme
Who-T: On commit messages

I have used CVS (and SVN to a lesser extent) in the past and log was a tool that was hardly ever used. Mostly because it was pretty useless, both the tool and the information available. These days I look at git logs more often than at code. The git log tool is vastly superior to CVS log and the commit discipline in the projects I'm working on now is a lot better. I grep git logs more often than code files and I use git blame all the time to figure out why a particular piece of code looks the way it does. It's certainly saving me a lot of time and effort. It's come to the point where the most annoying X server bugs are the ones where the git history stops at the original import from XFree86. If you're not using your SCM's log tool yet, I recommend to get more familiar with it.


Whitespace changes together with code changes. Needle in a haystack is a fun game, but not when you're looking at patches. It's a great way to introduce bugs, though because almost no-one will spot the bug hidden in hundreds of lines that got reindented for fun and profit.
git  vs  svn  subversion  versioncontrol  scm  commitmessages  styleguide  bestpractices 
february 2016 by kme
git - How do I push a local repo to Bitbucket using SourceTree without creating a repo on bitbucket first? - Stack Overflow
There is no "publish" feature in SourceTree for Windows v1.6, but you *can* create remotes on GitHub, Bitbucket, or Stash.
git  scm  versioncontrol  collaboration  github  bitbucket  stash  git-remote  sourcetree  windows  solution 
june 2015 by kme
How do you remove an invalid remote branch reference from Git? - Stack Overflow
git remote prune public

prune
Deletes all stale tracking branches under <name>. These stale branches have already been removed from
the remote repository referenced by <name>, but are still locally available in "remotes/<name>".

With --dry-run option, report what branches will be pruned, but do no actually prune them.
git  git-remote  git-branch  solution  devel  scm  versioncontrol 
june 2015 by kme
Learning Subversion: the mystery of .svn | Python Conquers The Universe
So now we know what a Subversion administrative directory contains.

The .svn admin directory contains pristine (unchanged) copies of files that were downloaded from the repository. (It contains a few other things, too.)
svn  versioncontrol  newbie  butwhy 
may 2015 by kme
What Is Subversion?
Distributed version control harnesses the growing ubiquity of high-speed network connections and low storage costs to offer an approach which differs from the centralized model in key ways. First and most obvious is the fact that there is no remote, central storehouse of versioned data. Rather, each user keeps and operates against very deep—complete, in a sense—local version history data stores. Collaboration still occurs, but is accomplished by trading changesets (collections of changes made to versioned items) directly between users' local data stores, not via a centralized master data store. In fact, any semblance of a canonical “master” source of a project's versioned data is by convention only, a status attributed by the various collaborators on that project.
dvcs  svn  git  compared  versioncontrol  devel  reference 
may 2015 by kme
Throw away local commits in git - Stack Overflow
A 'git rebase -i HEAD~4' just ended up staring at me blankly, so what actually worked was:
Simply delete your local master branch and recreate it like so:

git branch -D master
git checkout origin/master -b master


(no commits had been pushed to 'origin' at that point).
git  rebase  oops  gitfu  incantation  devel  sourcecontrol  versioncontrol  solution 
january 2015 by kme
uncommitted 1.6 : Python Package Index
See also https://github.com/jwiegley/git-scripts, which contains a Ruby 'git-all.rb' that does a lot (if not all) of the same things.
git  versioncontrol  script  python  devel  mercurial  hg  subversion  svn 
january 2015 by kme
« earlier      
per page:    204080120160

Copy this bookmark:





to read