Differences between git add and git stage?
I know that "git add [file(s)]", lets git to track (version control) specified list of file(s). But it seems we could use the same command instead of "git stage [file(s)]" which add file(s) to the list of nominated files for the next commit (snapshot). So what is the technical differences between functionality of "git add" and "git stage"? It is not rational to think about these two as git identical options/commands or consider "stage" as a redundant or non-necessary one.
Many thanks in advance for any clarification.
git git-bash
add a comment |
I know that "git add [file(s)]", lets git to track (version control) specified list of file(s). But it seems we could use the same command instead of "git stage [file(s)]" which add file(s) to the list of nominated files for the next commit (snapshot). So what is the technical differences between functionality of "git add" and "git stage"? It is not rational to think about these two as git identical options/commands or consider "stage" as a redundant or non-necessary one.
Many thanks in advance for any clarification.
git git-bash
add a comment |
I know that "git add [file(s)]", lets git to track (version control) specified list of file(s). But it seems we could use the same command instead of "git stage [file(s)]" which add file(s) to the list of nominated files for the next commit (snapshot). So what is the technical differences between functionality of "git add" and "git stage"? It is not rational to think about these two as git identical options/commands or consider "stage" as a redundant or non-necessary one.
Many thanks in advance for any clarification.
git git-bash
I know that "git add [file(s)]", lets git to track (version control) specified list of file(s). But it seems we could use the same command instead of "git stage [file(s)]" which add file(s) to the list of nominated files for the next commit (snapshot). So what is the technical differences between functionality of "git add" and "git stage"? It is not rational to think about these two as git identical options/commands or consider "stage" as a redundant or non-necessary one.
Many thanks in advance for any clarification.
git git-bash
git git-bash
edited Jan 18 at 6:17
amirfg
asked Jan 18 at 6:10
amirfgamirfg
136
136
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
There aren't any. As the manual page says,
GIT-STAGE(1) Git Manual GIT-STAGE(1)
NAME
git-stage - Add file contents to the staging area
SYNOPSIS
git stage args...
DESCRIPTION
This is a synonym for git-add(1). Please refer to the documentation of
that command.
GIT
Part of the git(1) suite
Git 2.20.1 12/15/2018 GIT-STAGE(1)
If you look at the source code – the built-in command list in git.c – you'll also see that they map to the same function and therefore are identical:
static struct cmd_struct commands = {
{ "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
...
{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
...
};
(You can also look at the cmd_add() function itself, and verify that it does not check what name it has been called by.)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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%2fsuperuser.com%2fquestions%2f1395627%2fdifferences-between-git-add-and-git-stage%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There aren't any. As the manual page says,
GIT-STAGE(1) Git Manual GIT-STAGE(1)
NAME
git-stage - Add file contents to the staging area
SYNOPSIS
git stage args...
DESCRIPTION
This is a synonym for git-add(1). Please refer to the documentation of
that command.
GIT
Part of the git(1) suite
Git 2.20.1 12/15/2018 GIT-STAGE(1)
If you look at the source code – the built-in command list in git.c – you'll also see that they map to the same function and therefore are identical:
static struct cmd_struct commands = {
{ "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
...
{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
...
};
(You can also look at the cmd_add() function itself, and verify that it does not check what name it has been called by.)
add a comment |
There aren't any. As the manual page says,
GIT-STAGE(1) Git Manual GIT-STAGE(1)
NAME
git-stage - Add file contents to the staging area
SYNOPSIS
git stage args...
DESCRIPTION
This is a synonym for git-add(1). Please refer to the documentation of
that command.
GIT
Part of the git(1) suite
Git 2.20.1 12/15/2018 GIT-STAGE(1)
If you look at the source code – the built-in command list in git.c – you'll also see that they map to the same function and therefore are identical:
static struct cmd_struct commands = {
{ "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
...
{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
...
};
(You can also look at the cmd_add() function itself, and verify that it does not check what name it has been called by.)
add a comment |
There aren't any. As the manual page says,
GIT-STAGE(1) Git Manual GIT-STAGE(1)
NAME
git-stage - Add file contents to the staging area
SYNOPSIS
git stage args...
DESCRIPTION
This is a synonym for git-add(1). Please refer to the documentation of
that command.
GIT
Part of the git(1) suite
Git 2.20.1 12/15/2018 GIT-STAGE(1)
If you look at the source code – the built-in command list in git.c – you'll also see that they map to the same function and therefore are identical:
static struct cmd_struct commands = {
{ "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
...
{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
...
};
(You can also look at the cmd_add() function itself, and verify that it does not check what name it has been called by.)
There aren't any. As the manual page says,
GIT-STAGE(1) Git Manual GIT-STAGE(1)
NAME
git-stage - Add file contents to the staging area
SYNOPSIS
git stage args...
DESCRIPTION
This is a synonym for git-add(1). Please refer to the documentation of
that command.
GIT
Part of the git(1) suite
Git 2.20.1 12/15/2018 GIT-STAGE(1)
If you look at the source code – the built-in command list in git.c – you'll also see that they map to the same function and therefore are identical:
static struct cmd_struct commands = {
{ "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
...
{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
...
};
(You can also look at the cmd_add() function itself, and verify that it does not check what name it has been called by.)
answered Jan 18 at 6:35
grawitygrawity
239k37506561
239k37506561
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- 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%2fsuperuser.com%2fquestions%2f1395627%2fdifferences-between-git-add-and-git-stage%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