Showing posts with label GIT. Show all posts
Showing posts with label GIT. Show all posts

Friday, 31 March 2017

Step wise how to set up GIT in eclipse

Step wise how to set up GIT in eclipse


Read my previous post about step wise how to create and merge new branch in GIT.

Step 1: 

Step wise how to set up GIT in eclipse


Step wise how to set up GIT in eclipse

Step 3: Select first option.

Step wise how to set up GIT in eclipse

Step wise how to set up GIT in eclipse

Step wise how to set up GIT in eclipse

Step 4: Click yes and installation complete.

Step wise how to set up GIT in eclipse

Step 5: Open customised perspective.

Step wise how to set up GIT in eclipse

Step 6: Select Git. It will add options in toolbar.

Step wise how to set up GIT in eclipse
Step 7: Go to preference.

Step wise how to set up GIT in eclipse

Step 8: Click on git and give path of local  repository created in earlier post.

Step wise how to set up GIT in eclipse

Step 9: Give email and name in configuration.
               user.name and user.email

Step wise how to set up GIT in eclipse

Step 10: Right click in project Explorer and go to import.

Step wise how to set up GIT in eclipse

Step 11: Select projects from git.

Step wise how to set up GIT in eclipse

Step 12: Select Existing local repository.

Step wise how to set up GIT in eclipse

Step 13: Click on Add.

Step wise how to set up GIT in eclipse

Step 14: Check the box. And click finish.

Step wise how to set up GIT in eclipse

Step 15: Select Git Repository name and next.

Step wise how to set up GIT in eclipse

Step 16: Select Import a general project and select on project name & click next.

Step wise how to set up GIT in eclipse

Step wise how to set up GIT in eclipse


Step 17: We can see project structure having src , WebContent and build.gradle if project is gradle.

Step wise how to set up GIT in eclipse

Step 18: Right click on project and configure then Add Gradle Nature.

Step wise how to set up GIT in eclipse


Related post:

Step wise how to create and merge new branch in GIT


Wednesday, 8 March 2017

Step wise how to create and merge new branch in GIT

Step wise how to create and merge new branch in GIT


Git install-able files can be download from here.  Install Git on your local system.

1. Create new folder in any of your drive. For example, I created TestRepo.
      2. Go to TestRepo folder and run git bash.

Step wise how to create new branch in GIT
Step wise how to create new branch in GIT

3  Cloning a remote repo.
    Command: git clone <URL>  <where to clone>
   Where <Url> is remote repository and <where to clone> is local repository where you will do          development.
Run command: git clone //20.XXX.58.XX/XXXX
Step wise how to create new branch in GIT

4After successfully clone, you will have all remote repository files. Our project is in some folder so I run cd command, if you don’t have than no need to run cd command.

5. Viewing information about the remote repository.
Command: git remote -v –-> This commands gives the information about remote repository
         : git branch -a --> This commands gives the information about all local and remote branches.

6Create a branch according to your work. For example, I created test_new, this branch created locally, this is not available on remote repository. Now me or other developer will work on this branch.
Command: git branch test_new
Step wise how to create new branch in GIT

7. If I will run git branch, this shows currently I am working on Master branch.

Step wise how to create new branch in GIT

8Need to switch into our new branch, where we will work.


Step wise how to create new branch in GIT

9. I done some changes on my code in one file and wanted to commit. So, first I will check status what all file changed.


Step wise how to create new branch in GIT

10. Go to add into staging area.

Step wise how to create new branch in GIT

11.Now we will commit this change to our local branch “test_new”


Step wise how to create new branch in GIT

12After commit into local branch, push local branch to Remote.


Step wise how to create new branch in GIT

13Now our local branch “test_new” shold be visible on remote repository.

Step wise how to create new branch in GIT

14Now we will merge branch with master. First we will checkout local master branch.

Step wise how to create new branch in GIT

15We will pull code from master repository and will check if any other developer has been checked their code or not. If we will get as “Already up-to-date” means no other developer commit their code in master repository.
Command: git pull origin master or git pull --no-edit origin master
If you use git pull origin master and if no changes made on central repository than no editor pop will come, if any changes made on central repository than you will get editor pop, you need to press shift and : together and write q. this will exit from editor command.
Or you can use git pull --no-edit origin master, this command will not pop up editor.

Now you need to merge code with your code if any changes made on central repository code. After changes need to only commit, this will commit in master branch. 
a. If central repository have no change than you don't required to do anything.

Step wise how to create new branch in GIT
     b. If automatic merge failed, you will receive below message than you need to remove conflicts by using "git mergetool". 

Step wise how to create new branch in GIT
Step wise how to create new branch in GIT

   Click enter and one window will pop up, you need to merge your code , save and close merging        tool.
Step wise how to create new branch in GIT

     16. After successfully merge. Now we will check our code is merged with in so far.

Step wise how to create new branch in GIT

     17Above command says, our code is merged with only local master branch. Now we will merge our branch test_new with local master branch.

Step wise how to create new branch in GIT
    
    18 If you will run branch merged command, this will show all branches which has been merged and ready to push into central repository.

    
Step wise how to create new branch in GIT


    19. We will push our merged code to central repository. Now updated code available to all developer from central repository.

Step wise how to create new branch in GIT

Delete a branch 


     1.     After successfully merge and push updated code to central repository we don’t need newly created branch.
    
     2.    Check once again if your branch has been merged with master or not. If this shows than you are good to delete newly created branch.

Step wise how to create new branch in GIT

3 Delete branch locally.

Step wise how to create new branch in GIT

4. Check if branch deleted from local or not. We have only master branch. But still we have branch in remote location.

Step wise how to create new branch in GIT

5Delete branch from remote.

Step wise how to create new branch in GIT