git clone https://github.com/username/project.git
git reset --soft HEAD^
git reset --hard HEAD^
mkdir -p ~/git_repository/sample/project_1 cd ~/git_repository/sample/project_1 # # --bare is for remote repository. If no --bare, I got the # following error when push # refusing to update checked out branch: refs/heads/master # git init --bare
mkdir -p ~/work/project_1 cd ~/work/ git clone ssh://username@localhost/home/username/git_repository/sample/project_1 # Now you have your local git work project # Add and push/pull
A--B--C--D <- origin/master (on remote) ============================================================ A--B--C <- (fetched) (local) ============================================================ A--B--C \---E---F <- master (local)
A--B--C--D ============= fetch syncs remote to fetch A--B--C--D ============================================================ A--B--C \---E---F <- master (local)
A--B--C--D <-- origin/master ============= A--B--C--D ============= rebase syncs fetched to master (local) and recommit local A--B--C--D \---E---F <- master (local)
A--B--C--D--E---F <- master (local) ^ | head
git checkout master
moves the head
to the master (branch)A--B--C--D--E---F <- master (local) ^ | head
git rebase
.
A--B--C--D--E--F--G--H <- fetched ====================== A--B--C--D--E--F <- master (local) ^ | head
git rebase
resolves the difference
between fetched and master.
A--B--C--D--E--F--G--H <- fetched ====================== A--B--C--D--E--F--G--H <- master (local) ^ | head
% git svn clone svn+ssh://svn.repository/svnroot/project/trunk/srcor only a part of it
#-- excluding excluding_dir from svn control % svn chechout svn+ssh://svn.repository/svnroot/project/trunk/src % cd src % svn update --set-depth exclude excluding_dir #-- partial git svn control % git svn clone svn+ssh://svn.repository/svnroot/project/trunk/src/excluding_dir
% git svn rebase
% git svn commitif some conflict or need to rebase, but not clean.
# -- push local change to stash % git stash # -- pull and update local % git svn rebase # -- merge pushed local change on stash % git stash pop % git svn commit
% git svn dcommit
% git rebase -i HEAD~10 # -- Then an editor will popup. # Replace keyword to squash where you want to squash and save.Note: 'git svn rebase' and 'git rebase' are totally different.
% git show REV:filename % # Ex. see revison HEAD -10's foo.cpp file. % git show HEAD~10:foo.cpp
(autoload 'magit-status "/magit/path//magit" nil t)
% git config diff.tool xxdiff % git difftool
% git config difftool.prompt false