How can I get the name of the last person who pushed to a remote?
I know that the option -force-with-lease
allows me to push force only if I was last committer but I would like to allow overriding it:
git push playground $current_branch:master --force-with-lease
if ! [[ "$?" == "0" ]]; then
last_committer="$(git some command)"
ask_continue "the last committer was $last_committer, would you like to push force?"
git push playground $current_branch:master --force
fi
In that example, I would like to know what git some command
would be.
bash git
add a comment |
I know that the option -force-with-lease
allows me to push force only if I was last committer but I would like to allow overriding it:
git push playground $current_branch:master --force-with-lease
if ! [[ "$?" == "0" ]]; then
last_committer="$(git some command)"
ask_continue "the last committer was $last_committer, would you like to push force?"
git push playground $current_branch:master --force
fi
In that example, I would like to know what git some command
would be.
bash git
1
Your plan is dangerous! if--force-with-lease
fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with--force
in that situation will remove the other contributors changes from the history.
– Timothy Truckle
yesterday
1
I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.
– Ulysse BN
yesterday
add a comment |
I know that the option -force-with-lease
allows me to push force only if I was last committer but I would like to allow overriding it:
git push playground $current_branch:master --force-with-lease
if ! [[ "$?" == "0" ]]; then
last_committer="$(git some command)"
ask_continue "the last committer was $last_committer, would you like to push force?"
git push playground $current_branch:master --force
fi
In that example, I would like to know what git some command
would be.
bash git
I know that the option -force-with-lease
allows me to push force only if I was last committer but I would like to allow overriding it:
git push playground $current_branch:master --force-with-lease
if ! [[ "$?" == "0" ]]; then
last_committer="$(git some command)"
ask_continue "the last committer was $last_committer, would you like to push force?"
git push playground $current_branch:master --force
fi
In that example, I would like to know what git some command
would be.
bash git
bash git
edited yesterday
Ulysse BN
asked yesterday
Ulysse BNUlysse BN
2,30111231
2,30111231
1
Your plan is dangerous! if--force-with-lease
fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with--force
in that situation will remove the other contributors changes from the history.
– Timothy Truckle
yesterday
1
I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.
– Ulysse BN
yesterday
add a comment |
1
Your plan is dangerous! if--force-with-lease
fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with--force
in that situation will remove the other contributors changes from the history.
– Timothy Truckle
yesterday
1
I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.
– Ulysse BN
yesterday
1
1
Your plan is dangerous! if
--force-with-lease
fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with --force
in that situation will remove the other contributors changes from the history.– Timothy Truckle
yesterday
Your plan is dangerous! if
--force-with-lease
fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with --force
in that situation will remove the other contributors changes from the history.– Timothy Truckle
yesterday
1
1
I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.
– Ulysse BN
yesterday
I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.
– Ulysse BN
yesterday
add a comment |
2 Answers
2
active
oldest
votes
git show --quiet --pretty=format:%an
--quiet
- suppresses the diff output
%an
- is the author name (For all other formats click this)
If you want to look who made last commit on a specific branch
git show --quiet --pretty=format:%an origin/branch-name
So in my casegit show --quiet --pretty=format:%an playground/master
. Thank you very much.
– Ulysse BN
yesterday
add a comment |
In order get the last commit details for author-name, date and time is
git log -1
Here you can find more detail for getting commit history.
https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History
hope this will help you.
add a comment |
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%2f54250839%2fhow-can-i-get-the-name-of-the-last-person-who-pushed-to-a-remote%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
git show --quiet --pretty=format:%an
--quiet
- suppresses the diff output
%an
- is the author name (For all other formats click this)
If you want to look who made last commit on a specific branch
git show --quiet --pretty=format:%an origin/branch-name
So in my casegit show --quiet --pretty=format:%an playground/master
. Thank you very much.
– Ulysse BN
yesterday
add a comment |
git show --quiet --pretty=format:%an
--quiet
- suppresses the diff output
%an
- is the author name (For all other formats click this)
If you want to look who made last commit on a specific branch
git show --quiet --pretty=format:%an origin/branch-name
So in my casegit show --quiet --pretty=format:%an playground/master
. Thank you very much.
– Ulysse BN
yesterday
add a comment |
git show --quiet --pretty=format:%an
--quiet
- suppresses the diff output
%an
- is the author name (For all other formats click this)
If you want to look who made last commit on a specific branch
git show --quiet --pretty=format:%an origin/branch-name
git show --quiet --pretty=format:%an
--quiet
- suppresses the diff output
%an
- is the author name (For all other formats click this)
If you want to look who made last commit on a specific branch
git show --quiet --pretty=format:%an origin/branch-name
answered yesterday
Praveen RajPraveen Raj
665
665
So in my casegit show --quiet --pretty=format:%an playground/master
. Thank you very much.
– Ulysse BN
yesterday
add a comment |
So in my casegit show --quiet --pretty=format:%an playground/master
. Thank you very much.
– Ulysse BN
yesterday
So in my case
git show --quiet --pretty=format:%an playground/master
. Thank you very much.– Ulysse BN
yesterday
So in my case
git show --quiet --pretty=format:%an playground/master
. Thank you very much.– Ulysse BN
yesterday
add a comment |
In order get the last commit details for author-name, date and time is
git log -1
Here you can find more detail for getting commit history.
https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History
hope this will help you.
add a comment |
In order get the last commit details for author-name, date and time is
git log -1
Here you can find more detail for getting commit history.
https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History
hope this will help you.
add a comment |
In order get the last commit details for author-name, date and time is
git log -1
Here you can find more detail for getting commit history.
https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History
hope this will help you.
In order get the last commit details for author-name, date and time is
git log -1
Here you can find more detail for getting commit history.
https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History
hope this will help you.
answered yesterday
Usama KiyaniUsama Kiyani
154
154
add a comment |
add a comment |
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%2f54250839%2fhow-can-i-get-the-name-of-the-last-person-who-pushed-to-a-remote%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
1
Your plan is dangerous! if
--force-with-lease
fails you should always check the remote history and merge the remote state of the branch into yours or rebase onto it. pushing with--force
in that situation will remove the other contributors changes from the history.– Timothy Truckle
yesterday
1
I want to remove the other contributors change, it is a playground environment where anyone can, well, play! Nonetheless, thank you for pointing that out for any user coming here. Don't do this if you are not aware of it.
– Ulysse BN
yesterday