1. Install Git for Windows
First install git for Windows recommended this: http://msysgit.github.io/
you can right-click a git command-line window with the corresponding path in any directory--git bash and start up faster
settings--version Control--git--path to Git executable in IntelliJ
Find the Git.exe installed in the Git bin directory
2. Applicable to existing projects
Create a warehouse on [email protected] to get an HTTP connection to the [email protected] Warehouse Http://git.oschina.net/lujianing/test2.git
If the local project non-GIT project first turns the project into a git project
Vcs--import into Version control--create Git Repository Select your local project in IntelliJ
Through the Git shell (you can install git for window) into the project directory execution
Git remote add Origin http://git.oschina.net/lujianing/test2.git
git push-u Origin master (This is a command-line commit project that can be used without executing the reference method in the IntelliJ push )
If the submission fails, please refer to the GIT prompt for resolution, such as having a remote address git remote rm Origin cleanup
If there are other files in the warehouse that are not in the local project You can refer to the following two figures first merge project
Project will be submitted to [email protected] After the change to submit the warehouse can refer to method one of the push operation
It's so simple, there's wood.
Here are some of the corresponding
3. Note the point:
One: where git bash related commands:
using git Bash under Windows, using Linux commands, there are several common file operations commands:
Windows Commands |
Linux Commands |
meaning |
CD e:\xxx |
cd/e/xxx |
switch to the XXX directory |
CD |
pwd |
Show current directory path |
dir |
ls |
List current directory contents |
copy nul xxx.txt |
Touch Xxx.txt |
generate an empty file named Xxx.txt |
del xxx.txt |
RM xxx.txt |
Delete xxx.txt file |
MD XXX |
mkdir xxx |
set up xxx directory |
rd/s xxx |
rm-r XXX
|
Delete xxx Directory
|
Two: Common commands:
git branch View all local branches git status View current status git commit commit git branch-A view all branches of Git branch-r View all remote branches git commit+a+"Init"Submit and annotate git remote add origin [email protected]192.168.1.119: Ndshowgit push Origin master pushes files to the server Git Remote show origin displays the resources of the remote library origin GIT push origin master:developgit push Origin MASTER:HB-Dev Associates a local library with a library on the server git checkout--track origin/Dev switch to remote dev branch git branch-D Master Develop delete local library Developgit checkout-b Dev Build a new local branch Devgit merge Origin/Dev merges the branch dev with the current branch git checkout dev switches to the local dev branch git remote show view remote library git Add. git rm file name (including path) Delete the specified file from git git clone git: //Github.com/schacon/grit.git Pull the code down from the servergit config--list See all users git ls-Files See the git rm [file name] that has been committed delete a file git commit-a commit all changes to the current repos git add [file name] Add a file to git indexgit commit-v When you use the-v argument you can see the difference of commit git commit-M"This is the message describing the commit"Add commit information git commit-A-A is on behalf of Add, add all the change to git index and then commitgit commit-A-v General commit command git log see your commit log git diff view unsaved updates git rm a.a Remove files (remove from staging area and workspaces) git rm--cached a.a Remove files (remove only from staging area) git commit-M"Remove"Remove files (remove from git) git rm-f a.a forcibly remove modified files (removed from staging area and workspaces) git diff--cached or $ git diff--staged view uncommitted updates git stash push files to a temporary space in Git stash pops pops files out of temporary space
Three: Create a local git branch, and then the class file in the project will be used
Git---> Add all the class files to the local branch git management
Four: Next, you can use Git commit, push and other commands, the initial submission, to remind the input [email protected] username and password
Of course, you can do it yourself, new Branch, create your own branch name
Five:
Git sets up multiple push remote warehouses or commits multiple push warehouses at the same time
Specific solutions:
In the hidden file. Git has a config file, open, and add the following information on the last line
?
1 2 3 |
[remote "all"] url = https://github.com/xxx/xxx.git url = https:// Github.com/yyy/yyy.git |
then we go back to idea and make the push commit update, and you'll see that the submit address has an all option.
under cmd You can also execute git push all to commit the update
and so on, you can also continue to add the Push warehouse address
Intellij idea using [email protected] to push local code to GIT