Why are files already staged, committed and pushed showing again as untracked, unstaged, or not committed?
I am relatively new to git and I have a question re this flow. Below, I switch to develop branch and sync it with remote develop branch. Then I create my-feature branch, modify it in some way, stage, commit and push to remote:
git checkout develop//switch to localdevelopbranch
git pull origin develop(orgit fetch origin/git merge origin/develop) //sync localdevelopwith remotedevelopbranch
git checkout -b my-feature//create new branch and switch to it, now I know it contains latest code from remote- Add and modify some files while on
my-featurebranch
git add .//stage all files I modified
git commit -m "message"//commit all staged files
git statussays "nothing to commit, working tree clean"
git push -u origin my-feature//push to remote with tracking option
git statussays "Your branch is up to date with 'origin/my-feature"
At this point, I am not done with my-feature. I still have work to do but I will do it in couple of days.
So, couple of days later, I want to continue on my-feature branch but I first want to make sure that my local develop and local my-feature branches are uptodate so I know that any merged pull request by other developers are now present in my local develop and my local my-feature branches so I reduce chance of possible conflicts.
So, I do following to make sure they are updated
git checkout develop//switch to localdevelopbranch
git pull origin develop(orgit fetch origin/git merge origin/develop) //bring latest merged code from remotedevelopto localdevelopbranch
git checkout my-feature//switch tomy-featurebranch to continue work on it. This shows "Your branch is up to date with 'origin/my-feature'"
To my understanding, I should now merge my updated local develop branch with my local my-feature branch by issuing git merge develop. This will merge develop with branch I am currently on which is my-feature branch. So, any merged pull requests from other developers at remote develop branch should be now integrated into my-feature branch and I can continue work on it knowing that I have latest remote changes. Doing this daily reduces chance of conflicts.
However, before doing so, I issue git status to see the status of my current branch which is my-feature branch.
What I find confusing is that I see some files I added or modified in step 4 above are now reported by git status as 'deleted' > 'to be committed', some as 'modified' > 'not staged', and some as 'untracked' files. Even more confusing is that when I switched to my-feature branch above in step 3, it shows "Your branch is up to date with 'origin/my-feature'", yet the files are showing are either not staged, or not committed, or not tracked.
Is this how it should be?
Should I now simply do git add and git commit again and if so why do I need to do it again if I already did it in steps 6 and 7 above?
Please provide some explanation, I am new to git and find it still confusing. I am familiar only with the commands I described above.
git git-push
add a comment |
I am relatively new to git and I have a question re this flow. Below, I switch to develop branch and sync it with remote develop branch. Then I create my-feature branch, modify it in some way, stage, commit and push to remote:
git checkout develop//switch to localdevelopbranch
git pull origin develop(orgit fetch origin/git merge origin/develop) //sync localdevelopwith remotedevelopbranch
git checkout -b my-feature//create new branch and switch to it, now I know it contains latest code from remote- Add and modify some files while on
my-featurebranch
git add .//stage all files I modified
git commit -m "message"//commit all staged files
git statussays "nothing to commit, working tree clean"
git push -u origin my-feature//push to remote with tracking option
git statussays "Your branch is up to date with 'origin/my-feature"
At this point, I am not done with my-feature. I still have work to do but I will do it in couple of days.
So, couple of days later, I want to continue on my-feature branch but I first want to make sure that my local develop and local my-feature branches are uptodate so I know that any merged pull request by other developers are now present in my local develop and my local my-feature branches so I reduce chance of possible conflicts.
So, I do following to make sure they are updated
git checkout develop//switch to localdevelopbranch
git pull origin develop(orgit fetch origin/git merge origin/develop) //bring latest merged code from remotedevelopto localdevelopbranch
git checkout my-feature//switch tomy-featurebranch to continue work on it. This shows "Your branch is up to date with 'origin/my-feature'"
To my understanding, I should now merge my updated local develop branch with my local my-feature branch by issuing git merge develop. This will merge develop with branch I am currently on which is my-feature branch. So, any merged pull requests from other developers at remote develop branch should be now integrated into my-feature branch and I can continue work on it knowing that I have latest remote changes. Doing this daily reduces chance of conflicts.
However, before doing so, I issue git status to see the status of my current branch which is my-feature branch.
What I find confusing is that I see some files I added or modified in step 4 above are now reported by git status as 'deleted' > 'to be committed', some as 'modified' > 'not staged', and some as 'untracked' files. Even more confusing is that when I switched to my-feature branch above in step 3, it shows "Your branch is up to date with 'origin/my-feature'", yet the files are showing are either not staged, or not committed, or not tracked.
Is this how it should be?
Should I now simply do git add and git commit again and if so why do I need to do it again if I already did it in steps 6 and 7 above?
Please provide some explanation, I am new to git and find it still confusing. I am familiar only with the commands I described above.
git git-push
add a comment |
I am relatively new to git and I have a question re this flow. Below, I switch to develop branch and sync it with remote develop branch. Then I create my-feature branch, modify it in some way, stage, commit and push to remote:
git checkout develop//switch to localdevelopbranch
git pull origin develop(orgit fetch origin/git merge origin/develop) //sync localdevelopwith remotedevelopbranch
git checkout -b my-feature//create new branch and switch to it, now I know it contains latest code from remote- Add and modify some files while on
my-featurebranch
git add .//stage all files I modified
git commit -m "message"//commit all staged files
git statussays "nothing to commit, working tree clean"
git push -u origin my-feature//push to remote with tracking option
git statussays "Your branch is up to date with 'origin/my-feature"
At this point, I am not done with my-feature. I still have work to do but I will do it in couple of days.
So, couple of days later, I want to continue on my-feature branch but I first want to make sure that my local develop and local my-feature branches are uptodate so I know that any merged pull request by other developers are now present in my local develop and my local my-feature branches so I reduce chance of possible conflicts.
So, I do following to make sure they are updated
git checkout develop//switch to localdevelopbranch
git pull origin develop(orgit fetch origin/git merge origin/develop) //bring latest merged code from remotedevelopto localdevelopbranch
git checkout my-feature//switch tomy-featurebranch to continue work on it. This shows "Your branch is up to date with 'origin/my-feature'"
To my understanding, I should now merge my updated local develop branch with my local my-feature branch by issuing git merge develop. This will merge develop with branch I am currently on which is my-feature branch. So, any merged pull requests from other developers at remote develop branch should be now integrated into my-feature branch and I can continue work on it knowing that I have latest remote changes. Doing this daily reduces chance of conflicts.
However, before doing so, I issue git status to see the status of my current branch which is my-feature branch.
What I find confusing is that I see some files I added or modified in step 4 above are now reported by git status as 'deleted' > 'to be committed', some as 'modified' > 'not staged', and some as 'untracked' files. Even more confusing is that when I switched to my-feature branch above in step 3, it shows "Your branch is up to date with 'origin/my-feature'", yet the files are showing are either not staged, or not committed, or not tracked.
Is this how it should be?
Should I now simply do git add and git commit again and if so why do I need to do it again if I already did it in steps 6 and 7 above?
Please provide some explanation, I am new to git and find it still confusing. I am familiar only with the commands I described above.
git git-push
I am relatively new to git and I have a question re this flow. Below, I switch to develop branch and sync it with remote develop branch. Then I create my-feature branch, modify it in some way, stage, commit and push to remote:
git checkout develop//switch to localdevelopbranch
git pull origin develop(orgit fetch origin/git merge origin/develop) //sync localdevelopwith remotedevelopbranch
git checkout -b my-feature//create new branch and switch to it, now I know it contains latest code from remote- Add and modify some files while on
my-featurebranch
git add .//stage all files I modified
git commit -m "message"//commit all staged files
git statussays "nothing to commit, working tree clean"
git push -u origin my-feature//push to remote with tracking option
git statussays "Your branch is up to date with 'origin/my-feature"
At this point, I am not done with my-feature. I still have work to do but I will do it in couple of days.
So, couple of days later, I want to continue on my-feature branch but I first want to make sure that my local develop and local my-feature branches are uptodate so I know that any merged pull request by other developers are now present in my local develop and my local my-feature branches so I reduce chance of possible conflicts.
So, I do following to make sure they are updated
git checkout develop//switch to localdevelopbranch
git pull origin develop(orgit fetch origin/git merge origin/develop) //bring latest merged code from remotedevelopto localdevelopbranch
git checkout my-feature//switch tomy-featurebranch to continue work on it. This shows "Your branch is up to date with 'origin/my-feature'"
To my understanding, I should now merge my updated local develop branch with my local my-feature branch by issuing git merge develop. This will merge develop with branch I am currently on which is my-feature branch. So, any merged pull requests from other developers at remote develop branch should be now integrated into my-feature branch and I can continue work on it knowing that I have latest remote changes. Doing this daily reduces chance of conflicts.
However, before doing so, I issue git status to see the status of my current branch which is my-feature branch.
What I find confusing is that I see some files I added or modified in step 4 above are now reported by git status as 'deleted' > 'to be committed', some as 'modified' > 'not staged', and some as 'untracked' files. Even more confusing is that when I switched to my-feature branch above in step 3, it shows "Your branch is up to date with 'origin/my-feature'", yet the files are showing are either not staged, or not committed, or not tracked.
Is this how it should be?
Should I now simply do git add and git commit again and if so why do I need to do it again if I already did it in steps 6 and 7 above?
Please provide some explanation, I am new to git and find it still confusing. I am familiar only with the commands I described above.
git git-push
git git-push
edited Nov 14 '18 at 19:33
isherwood
37.2k1082111
37.2k1082111
asked Nov 14 '18 at 19:05
cd491415cd491415
317110
317110
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307143%2fwhy-are-files-already-staged-committed-and-pushed-showing-again-as-untracked-u%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307143%2fwhy-are-files-already-staged-committed-and-pushed-showing-again-as-untracked-u%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown