Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Android Studio and Git Git configuration file status     - Redmine Installation (Linux)

- Compiled version of Android Opus audio codec library method (Programming)

- Ubuntu 14.04 compile and install Apache (Server)

- Red Hat Enterprise Linux 6.4 Configuring VNC Remote Desktop login access (Linux)

- struts2 completely the wrong way to capture 404 (Programming)

- To learn linux security (Linux)

- Java JDK has been able to compile without warning (Programming)

- How to generate Linux, random password encryption or decryption (Linux)

- Ubuntu install Lighttpd + Mono support .net (Linux)

- cat command uses the Linux redirection merge files (Linux)

- Installation Android IDE development tools, Android Studio 1.5 under Ubuntu (Linux)

- Phoenix agents use P2P WebRTC development (Programming)

- Use Python to perform system commands common usage (Programming)

- Repair CentOS 6.4 Grub boot (Linux)

- Do not enter password login ssh (Server)

- Redis Linux system installation guide (Database)

- hadoop 2.7.1 High Availability Setup Deployment (Server)

- Installation of Ubuntu Make under Ubuntu 15.10 (Linux)

- Boost-- time and date - (1) timer library introduction (Programming)

- BusyBox build root file system (Linux)

 
         
  Android Studio and Git Git configuration file status
     
  Add Date : 2018-11-21      
         
         
         
  Android Studio Git configuration is relatively simple, it is possible the problems appeared in the middle of trouble. If you want to know or are interested, please read on.

First you have to download Git client, the URL: http: //git-scm.com/download/.

According to need to download the appropriate version, and install it. Then specify git.exe in Android Studio, click "Test", the following tips will pop success.

Since I use Android Studio 2.0 Preview, does not exist prompted "Enable Version Control Integration", causing me to look for a long T ~ T. In fact, there is a similar operation.

Is the "Create Git Repository", otherwise you will always get "... such that source detected in git but Unregistered Vcs root detected" prompt.

This is done, git down it is to add a remote. I use open source code hosting Chinese online first to get an address: https: //git.oschina.net/***.git.

Open git base, and switch to the project's root directory, enter the following command

git remote add origin https://git.oschina.net/***.git
Hopefully this step is complete.

Then git add operations In Android Studio.

It followed commit directory, and finally push the code to the remote repository.

At this point, the end of the submission.

By default, the project will have Android Studio of these folders:. Build, libs, src, but each time you submit the code to git, will be prompted to build a file folder in the many required to submit, in fact, we do not care about build file folder changes the situation. How to do it? .gitignore Use it to filter out.

Establish .gitignore file in the root directory of the project, and then add

build
It's that simple! If you want to filter other files, add the corresponding rule on it.

After saving .gitignore file, you need to run the following command to submit .gitignore file to the git.

git rm -r --cached.
git add.
git commit -m "Add .gitignore File"
git push origin master
"Git rm -r - cached in a directory," this command is a little hard, will target directory empty, - cached (Note: This means that all of the files, there is a point); "git add.", Then. all the file back to the cache (stages new and modified, without deleted). If you currently have the latest and the other documents already push to a remote repository, you can use add .gitignore trouble.

In addition, you can use the following command instead of git rm -r --cached.

git add -A
Represent stages All. Novice may not understand. Well, I start with the git in three states and file conversion.

1. First, I created a git test.txt in the corresponding project directory and enter the following string and save it.

Hello
2, open git bash, enter the command git status, view the file status

You will see red test.txt be submitted in the state, the file is marked as Untracked files, and suggest you use git add ... command file that contains the list to be submitted.

3. Follow the prompts, use the command git add test.txt, this file is added to the git snapshots, git status again

At this time test.txt state became Changes to be committed, waiting to be submitted. It also prompts you to then use git reset HEAD ... can be reduced to the status of the file buffer status, that status back Untracked files.

4, open test.txt, to which add some content, save.

Hello
world
In fact, the more the world this string. Check again with git status file status.

In addition to the previous "Changes to be committed" state, but also more "Changes not staged for commit" state indicates that the file has been modified, but the modification has not been placed in the staging area, which is not a snapshot. If the commit operation at this time will only submit "Hello", ignore the "world".

When prompted, if you want the latest changes "Hello world" into the repository, you need to use the command git add test.txt again; if you want to undo changes that just submit "Hello", you can use git checkout - test.txt, again git status, you can see the status has changed.

Summary: So, before the file is not ready to commit, the presence of three states:. Untracked files, Changes not staged for commit, Changes to be committed to each state can be freely converted.

In subsequent versions of git, add the git stage git add as a synonym, so semantically more in line with the above Changes not staged for commit. Why do you want to increase the stage?

1, submitted in batches, commit to reduce particle size.

2, file snapshots to facilitate rollback.

If you commit too many files on the subsequent rollback or follow-up is undoubtedly very bad, the problem is not locate it, experienced a clear estimate. For example, you do two functions A and B, the corresponding file modifications are a1.java, a2.java; b1.java, b2.java, when it can be submitted to:

git stage a1.java a2.java
git commit -m "function A"
git stage b1.java b2.java
git commit -m "function B"
At the same time, each modified stage, at any time, you can return to the previous staged states:

git checkout - test.txt
If you want to delete from the stage, use the reset

git reset test.txt
This command is git stage test.txt inverse operation.
     
         
         
         
  More:      
 
- Examples of testing and installation Mesos on CentOS (Linux)
- MongoDB slice simple example (Database)
- Linux, C programming language library file handling and preparation of Makefile (Programming)
- What is a logical partition management LVM, how to use in Ubuntu (Linux)
- Configuring automatic mail GAMIT under CentOS system (Linux)
- Linux Apache server configure to protect system security (Linux)
- How to create a someone project on github (Linux)
- MySQL script incremental backups (innobackupex) (Database)
- Linux kernel network subsystem analysis (Programming)
- Repair Raspbian Encountered a section with no Package (Linux)
- Figlet use (Linux)
- Tmux create the perfect terminal management tool under CentOS (Linux)
- Linux shell scripts bubble sort (Programming)
- Oracle common internal event tracking number (Database)
- Use Ansible efficient delivery Docker container (Server)
- MySQL multi-master multi-cluster deployment uses alive Galera (Database)
- How to remove the files inside the privacy of data on Linux (Linux)
- Ubuntu install OpenMPI (Linux)
- Linux operating system boot process analysis (Linux)
- RHEL 5.7 Yum configure local source [Errno 2] No such file or directory (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.