After running git push or git push origin, git status will again tell you your branch is up to date with its remote tracking branch. This simply tells you that you have 1 new local commit that hasn't been pushed to the remote repository with git push yet. If you make one new commit locally and then run git status again, git will report Your branch is ahead of 'origin/master' by 1 commit. This means your active branch is in-sync with its remote tracking branch. Most of the time, git status will tell you Your branch is up to date with 'origin/master'. This helps Git manage syncing branches when you connect to a remote repository via git fetch, git pull, or git push. The second piece of info git status provides is the active branch syncing status with its remote tracking branch.Ī remote tracking branch is local copy of each of your branches that Git creates behind the scenes. Is my Git branch in sync with the remote branch? Git branch will list the local branches in your Git repository, and put an asterisk next to the currently active branch: > git branch You can double-check this by running the git branch command. This tells you what branch name is currently checked out in the working directory. The first piece of data git status tells you is what branch you're on, such as On branch master or On branch dev or On branch featureBranch1. Git status is your best friend when you ask yourself any of the following questions. ![]() Note that the current Git branch (1) and branch syncing status (2) will show up any time you execute git status.Īlso note that Changes to be committed (3), Changes not staged for commit (4), and Untracked files (5), will only be displayed if a file exists and meets the conditions for that section. " to include in what will be committed)Īs you can see, we added the numbers (1) - (5) to the output corresponding to the bullet points in the previous section. " to discard changes in working directory) (2) Your branch is up to date with 'origin/master'. Running the command git status provides the following output by default: (1) On branch master So make sure you use cd to navigate into your development project before running git commands. If you run git status outside of any Git repository, you'll probably get the following fatal Git error: > git statusįatal: not a git repository (or any of the parent directories). What is the output of the Git status command? Finally we'll go over some lesser-known command-line options for git status usage and mention some related Git commands. We'll also cover when to use git status, and provide some git status examples. In this article, we'll discuss each of these points in-depth so you understand how to use this information.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |