Git: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Undo revision 444 by Ovipowumon (talk) |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 18: | Line 18: | ||
$ git commit | $ git commit | ||
== Add a repo to gitosis == | |||
<pre> | |||
mkdir free_monkey | |||
cd free_monkey | |||
git init | |||
git remote add origin git@YOUR_SERVER_HOSTNAME:free_monkey.git | |||
# do some work, git add and commit files | |||
git push origin master:refs/heads/master | |||
</pre> | |||
== Importing from CVS == | == Importing from CVS == | ||
| Line 36: | Line 49: | ||
== Default Push Action == | == Default Push Action == | ||
warning: You did not specify any refspecs to push, and the current remote | |||
warning: has not configured any push refspecs. The default action in this | |||
warning: case is to push all matching refspecs, that is, all branches | |||
warning: that exist both locally and remotely will be updated. This may | |||
warning: not necessarily be what you want to happen. | |||
warning: | |||
warning: You can specify what action you want to take in this case, and | |||
warning: avoid seeing this message again, by configuring 'push.default' to: | |||
warning: 'nothing' : Do not push anything | |||
warning: 'matching' : Push all matching branches (default) | |||
warning: 'tracking' : Push the current branch to whatever it is tracking | |||
warning: 'current' : Push the current branch | |||
git config --global push.default matching | git config --global push.default matching | ||
Latest revision as of 22:16, 24 November 2010
Creating a new Project[edit]
$ tar xzf project.tar.gz $ cd project $ git init
Git will reply
Initialized empty Git repository in .git/
You've now initialized the working directory--you may notice a new directory created, named ".git".
Next, tell git to take a snapshot of the contents of all files under the current directory (note the .), with git-add:
$ git add .
This snapshot is now stored in a temporary staging area which git calls the "index". You can permanently store the contents of the index in the repository with git-commit:
$ git commit
Add a repo to gitosis[edit]
mkdir free_monkey cd free_monkey git init git remote add origin git@YOUR_SERVER_HOSTNAME:free_monkey.git # do some work, git add and commit files git push origin master:refs/heads/master
Importing from CVS[edit]
$ git cvsimport -v -d <cvsroot> -C <destination> <module>
Push local branch to Repo[edit]
$ git push origin branchname
List all remote branches[edit]
$ git branch -a
Checkout remote branch into local branch[edit]
$ git checkout -b experimental origin/experimental
Default Push Action[edit]
warning: You did not specify any refspecs to push, and the current remote warning: has not configured any push refspecs. The default action in this warning: case is to push all matching refspecs, that is, all branches warning: that exist both locally and remotely will be updated. This may warning: not necessarily be what you want to happen. warning: warning: You can specify what action you want to take in this case, and warning: avoid seeing this message again, by configuring 'push.default' to: warning: 'nothing' : Do not push anything warning: 'matching' : Push all matching branches (default) warning: 'tracking' : Push the current branch to whatever it is tracking warning: 'current' : Push the current branch
git config --global push.default matching