![]() Git config -global trueĪfter this instead of git diff, you can use git difftool. Git config -global 'diffmerge -merge -result="$MERGED" "$LOCAL" "$(if test -f "$BASE" then echo "$BASE" else echo "$LOCAL" fi)" "$REMOTE"' Git config -global 'diffmerge "$LOCAL" "$REMOTE"' Run following commands on your machine to set diffmerge as git's diff and merge tool.Please download "installer" version, not "DMG" version. There are many tools but we prefer and recommend diffmerge. If (ntainsKey(id)) student = students.Using visual git tools can save time and help you efficiently review changes. 2.6 Implement the New FeatureĪdd the following method to StudentRepository.java in the package and save the changes. Now we can happily work on the new feature without affecting the master branch. Note: To create and switch to the branch using a single command, you can use the -b option with the checkout command. Git checkout Command Output Switched to branch 'Feature1' ![]() To switch to the Feature1 branch, run the following command: $ git checkout Feature1 Let’s switch to the Feature1 branch so we can work on the new feature. The * next to master tells us that we are in the master branch (the mainline). Now run the following command: $ git branchĪs you can see from the output, there are two branches now. Create a new branch named ‘Feaure1’ with the following Git command: $ git branch Feature1 The first thing we should do is create a branch. Let us imagine that there is a request to implement a new feature that gives the consumer of our API the ability to delete a student from the datastore. Our application is a REST API student management service that allows clients to read, add, and update students. Git commit Command Output master (root-commit) e682818] initial commit of projectĬreate mode 100755 REST-API/.mvn/wrapper/maven-wrapper.jarĬreate mode 100755 REST-API/.mvn/wrapper/maven-wrapper.propertiesĬreate mode 100755 REST-API/src/main/java/com/javacodegeeks/example/RestApiApplication.javaĬreate mode 100755 REST-API/src/main/java/com/javacodegeeks/example/controller/StudentController.javaĬreate mode 100755 REST-API/src/main/java/com/javacodegeeks/example/model/Student.javaĬreate mode 100755 REST-API/src/main/java/com/javacodegeeks/example/repository/StudentRepository.javaĬreate mode 100755 REST-API/src/main/resources/application.propertiesĬreate mode 100755 REST-API/src/main/resources/eyre.jsonĬreate mode 100755 REST-API/src/main/resources/gates.jsonĬreate mode 100755 REST-API/src/test/java/com/javacodegeeks/example/RestApiApplicationTests.java 2.4 Create a New Branch Note: The -m option allows us to add a commit message inline. To commit the files from the staging area to the repository, run the following command: $ git commit -m 'Initial commit of project' New file: REST-API/src/test/java/com/javacodegeeks/example/RestApiAppl icationTests.java New file: REST-API/src/main/resources/gates.json New file: REST-API/src/main/resources/eyre.json New file: REST-API/src/main/resources/application.properties New file: REST-API/src/main/java/com/javacodegeeks/example/repository/ StudentRepository.java New file: REST-API/src/main/java/com/javacodegeeks/example/model/Stude nt.java New file: REST-API/src/main/java/com/javacodegeeks/example/controller/ StudentController.java New file: REST-API/src/main/java/com/javacodegeeks/example/RestApiAppl ication.java New file: REST-API/.mvn/wrapper/maven-wrapper.properties New file: REST-API/.mvn/wrapper/maven-wrapper.jar You can run the git status command to see the changes that are to be committed. The project files and folders are now in the staging area. This will add all the files and folders of the current directory, recursively, to the repository index. Run the following command (don’t forget the dot at the end): $ git add.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |