Working with git in Android Studio using Github – PART 2
Articles Blog

Working with git in Android Studio using Github – PART 2

August 14, 2019

Hi guys, this is the part 2 video in the series working with git in android studio using github So in this tutorial we’ll be basically going through what all commands are needed in pushing changes that have been saved in our local git copy to the repository which lies in github So in simple words, what we’ll be doing in this tutorial is that we’ll be making a change to our android studio project and then committing this change in our local git repo and then finally pushing it to our remote git repository So for that First of all open up your terminal within your android studio and there is a command called “git status” This command actually checks for if there are any changes that have already been made to our project so that we can make a commit with that particular change So right now when i run the command git status, it says that “your branch is up to date with origin/master” and then it says that “nothing to commit, working tree clean” which means that there is nothing to commit and therefore there are no changes to be pushed to the github repository. So basically in order to push something to the github repository, we’ll need to make some changes within our local repository So go ahead and add a comment over here we’re adding “test comment” “test comment” “test comment” Now if we go ahead and check “git status” again, we can now see that the git has identified a change which has been made and which has not already been committed. So first of all in order to push this change to our remote git repository, first we’ll need to change this within our local git repository So for that first you’ll need to add this change to the local git So for that you’ll need another command which is called “git add .” “git add .” “git add .” “git add .” So basically what this command does is that it adds all the files which has been changed in our project to the local git Now its added, but now in order to save the changes within our local git, we’ll need to commit it with a commit message So we’ll be giving it as git commit -m “commit 1” git commit -m “commit 1” git commit -m “commit 1” git commit -m “commit 1”, you can give any commit message of your choice actually, so i’m actually giving here it as commit 1 and then we’ll click enter Now that we have executed the commit command, all the changes that we have right now made in our local git repository have been saved, i mean got saved to the local git repository Now we’ll need to push this change into our remote repository which lies within our github host So first of all for that we’ll need to have another command which is called push command So basically the branch we are working on is master. So we’ll be pushing all the changes to master Now that all the changes have been saved in local repository, we are good to go and we can forward directly to pushing the changes to master. So go ahead and run this command git push origin master git push origin master git push origin master hit enter We can see that it says completed with three local objects and now we’ll need to go to our github repository in the browser and check if the push has been successful you can see that inside app>>src>>main>>(>)>> inside app>>src>>main>>(>)>> inside app>>src>>main>>(>)>> you can see the test comment over here which means that our push command has successfully worked So in this tutorial we have gone through commands like git status, git add, git commit, and git push and with this, we have come to the end of part 2 of the tutorial So for further such videos please subscribe to the channel and leave a like Thanks for watching

Leave a Reply

Your email address will not be published. Required fields are marked *